' URL that generated this code:
' http://txt2re.com/index-vb6.php3?s=11:Jan:2019%20%22This%20is%20an%20Example!%22&-15&9999
Private Sub Command1_Click()
Dim txt As String
txt ="11:Jan:2019 ""This is an Example!"""
Dim re1 As String
re1 ="" ' 1
Dim re2 As String
re2 =".*?" 'Non-greedy match on filler
Dim re3 As String
re3 ="an" 'Uninteresting: word
Dim re4 As String
re4 =".*?" 'Non-greedy match on filler
Dim re5 As String
re5 ="(an)" 'Word 1
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 1
1=m.Item(0).SubMatches.Item(0)
Dim word1
word1=m.Item(0).SubMatches.Item(1)
MsgBox("("+1+")"+"("+word1+")"+"")
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:
'-----