' URL that generated this code:
' http://txt2re.com/index-vb6.php3?s=42%2043&2&-10&-6
Private Sub Command1_Click()
Dim txt As String
txt ="42 43"
Dim re1 As String
re1 =".*?" 'Non-greedy match on filler
Dim re2 As String
re2 ="(2)" 'Any Single Digit 1
Dim re3 As String
re3 ="( )" 'Any Single Character 1
Dim re4 As String
re4 ="(\d+)" 'Integer Number 1
Dim r As New RegExp
r.Pattern = re1+re2+re3+re4
r.IgnoreCase = True
Dim m As MatchCollection
Set m = r.Execute(txt)
If m.Item(0).SubMatches.Count > 0 Then
Dim d1
d1=m.Item(0).SubMatches.Item(0)
Dim c1
c1=m.Item(0).SubMatches.Item(1)
Dim int1
int1=m.Item(0).SubMatches.Item(2)
MsgBox("("+d1+")"+"("+c1+")"+"("+int1+")"+"")
End If
End Sub
'-----
' To run this code:
' .Start Microsoft Visual Basic 6.0.
' .On the File menu, click New Project.
' .Click Standard Exe in the New Project dialog box, and then click OK.
' .On the Project menu, click References.
' .Double-click Microsoft VBScript Regular Expressions 5.5, and then click OK.
' (If you can't find this option, download "Microsoft Windows Script 5.6"
' from Microsoft)
' .In the toolbox, double-click CommandButton.
' .Double-click Command1 to open the Code window.
' .Paste the code above into the Command1_Click event handler:
'-----
 
Feedback
ShubhamGupta::
Saved my day!
Wed, 29 May 2013 11:36PM
::
Thu, 30 May 2013 12:02AM
Astarte::
Awesome, just awesome!
Thu, 30 May 2013 12:03AM
David Dawkins::
Excellent tool, where's the donate link? thank-you !!!