VB6 如何取正则表达式的值?

我知道如何使用表达式,匹配IP格式。。但是怎么取值。。例如:模块:PublicFunctionisValidIpAddress(strIpAddressAsString)... 我知道如何使用表达式,匹配IP格式。。但是怎么取值。。
例如:
模块:
Public Function isValidIpAddress(strIpAddress As String) As Boolean
On Error Resume Next
Dim reg As New RegExp
reg.IgnoreCase = True
reg.Global = True
reg.MultiLine = True
reg.Pattern = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"

isValidIpAddress = reg.Test(strIpAddress)

If isValidIpAddress = True Then
Dim strArr() As String
strArr = Split(strIpAddress, ".")

For i = 0 To UBound(strArr)
isValidIpAddress = isValidIpAddress And isValidIpNumber(strArr(i))
Next i
End If
End Function

条件:一个text,一个command
text1.text="textbox value=244.85.197.14z.zcls="z-textbox" z.type="zul.vd.Txbox"""
单击command1

If isValidIpAddress(Text1.Text) = True Then
MsgBox "有效IP :" '正则表达式返回值
Else
MsgBox "无效IP"
End If
End Sub

其中上面的 正则表达式返回true,但是如何取 text1.text 里面的 244.85.197.14,这个值呢?
展开
 我来答
yugi111
2017-07-23 · TA获得超过8.1万个赞
知道大有可为答主
回答量:5.1万
采纳率:70%
帮助的人:1.4亿
展开全部
var reg = /.*value[=\"\']+([\d\.]+)[\"\'a-zA-Z].*/;
var str = "";
str.replace(reg,"$1")
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式