|
回复 5# 阳光下的橙子
这段我试了一下,不能直接这样判断,我修改了一下:
Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches, count
count = 0
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(strng)
For Each Match in Matches
count = count+1
Regstr = Regstr&count&":"&Match.Value&vbcrlf
Next
If count > 0 Then
MsgBox "在字符串中找到"&count&"个匹配值",1,"结果输出"
RegExpTest = Regstr
Else
MsgBox "在字符串中找不到匹配值",1,"结果输出"
RegExpTest = "结果为空"
End if
End Function
msgbox(RegExpTest("is.", "IS1 is2 IS3 is4"))
楼主你可以直接放到QTP里跑跑就知道了,这个可以直接用 |
|