Vivka,
Thank you for your kind words. I was not able to get you suggestion to work. While it will match:
Test, Joe Smith, and test, test.
or
Test, Bob Miller, and test, text.
It will not match any of the examples given in post #3.
Consider:
Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim strPattern As String
Dim RegEx As RegExp, Matches As Object, Match As Object
Dim oPar As Paragraph
'strPattern = ",(\s[A-Z][a-z]+)+," 'Vivka's
strPattern = ",\s[A-Z][^,]*," 'Revised
Set RegEx = CreateObject("vbscript.regexp")
For Each oPar In ActiveDocument.Range.Paragraphs
With RegEx
.Pattern = strPattern
Set Matches = RegEx.Execute(oPar.Range.Text)
For Each Match In Matches
Debug.Print Match.Value
Next
End With
Next oPar
lbl_Exit:
Exit Sub
End Sub