'引用:Microfoft VBScript Regular Expressions 5.5
'一个正则提取功能
Public Function regGetStr_three(ByVal myString As String, ByVal patReg As String) As String()
Dim objRegExp As RegExp
Dim objMatch As Match
Dim colMatches As MatchCollection
Dim RetStr As String
Dim y() As String, j As Integer
ReDim y(0)
Set objRegExp = New RegExp
' objRegExp.Pattern = "a/[/d{1,3}/]=""?(.{1,})""?/.split"
objRegExp.Pattern = patReg
objRegExp.IgnoreCase = True
objRegExp.Global = True
j = -1
If (objRegExp.Test(myString) = True) Then
Set colMatches = objRegExp.Execute(myString)
For Each objMatch In colMatches
j = j + 1
ReDim Preserve y(j)
y(j) = objMatch.SubMatches(0) + "," + objMatch.SubMatches(1) + "," + objMatch.SubMatches(2)
Next
Else
RetStr = "String Matching Failed"
End If
regGetStr_three = y
End Function