Using the Microsoft VBScript Regular Expressions 5.5 library in
MS-Access VBA 6.3.
I understand why the code below finds an occurance of the string "PC:
blah blah blah A: BBB aaa B: BBB bbb C: BBB ccc"" but I cannot think
how to make it find all such strings.
My two alternative kludges are;
- build up a pattern of subpatterns until the pattern will not match
- add some hard delimiter (unusual single character) and divide the
incoming document into sections first
Any help would be great.
Function bigregexp()
' Search all the words in a string
Dim re As New regexp, m As Match
Dim t As String, i As Integer
t = "jfk jfk jfk AAA PC:AAA junk A: AAA aaa B: AAA bbb C: AAA ccc
BBB " & _
"PC: BBB junk A: BBB aaa B: BBB bbb C: BBB ccc"
re.Pattern = "(PC:.*A:(.+)B:(.+)C:(.+))"
re.Global = True
For Each m In re.Execute(t)
For i = 0 To m.SubMatches.Count - 1
MsgBox ("Pattern: " & m.SubMatches(i))
Next i
Next
End Function