Code:
Sub regexp()
Dim s(3) As String
s(0) = "recent photo"
s(1) = "photo"
s(2) = "recentphoto"
With CreateObject("vbscript.regexp")
.Pattern = "(recent ){0,1}photo"
.IgnoreCase = True
.Global = True
For x = 0 To 2
For Each oMatch In .Execute(s(x))
MsgBox oMatch
Next oMatch
Next
End With
End Sub
Eventually, I want these combinations only:
"photo"
"recent photo"
but don't want:
"recentphoto"
Thank you.