Function TestRegExp(myString As String)
Dim objRegExp As RegExp
Dim objMatch As Match
Dim colMatches As MatchCo
Function TestRegExp(myString As String)
Dim objRegExp As RegExp
Dim objMatch As Match
Dim colMatches As MatchCollection
Dim RetStr As String
Set objRegExp = New RegExp
objRegExp.Pattern = "
objRegExp.IgnoreCase = True
objRegExp.Global = True '表示搜索多个匹配项,false的话找完第一个匹配项就停止
If (objRegExp.Test(myString) = True) Then
Set colMatches = objRegExp.Execute(myString)
For Each objMatch In colMatches
RetStr = RetStr & "Match found at position "
RetStr = RetStr & objMatch.FirstIndex & ". Match Value is ''"
RetStr = RetStr & objMatch.Value & "''." & vbCrLf
Next
MsgBox "符合项:" & colMatches.Count
Else
RetStr = "String Matching Failed"
End If
TestRegExp = RetStr
End Function
先用了:
..
再用:
..
..
..
在此谢过
展开
全部