Private Sub Command1_Click()
Dim txt As String
txt ="42 43"
Dim re1 As String
re1 =".*?"
Dim re2 As String
re2 ="."
Dim re3 As String
re3 ="(.)"
Dim re4 As String
re4 =".*?"
Dim re5 As String
re5 ="(\d+)"
Dim r As New RegExp
r.Pattern = re1+re2+re3+re4+re5
r.IgnoreCase = True
Dim m As MatchCollection
Set m = r.Execute(txt)
If m.Item(0).SubMatches.Count > 0 Then
Dim c1
c1=m.Item(0).SubMatches.Item(0)
Dim int1
int1=m.Item(0).SubMatches.Item(1)
MsgBox("("+c1+")"+"("+int1+")"+"")
End If
End Sub
|