Regular Expressions
I’m trying to write a regular expression where the string matches “_Clauses” OR “_OL” but NOT “_Word”. Can anyone help? The OR part works, the NOT doesn’t.
Dim regex As Object, str As String
Set regex = CreateObject("VBScript.RegExp")
With regex
.Pattern = "_Clauses|_OL[^_Word]"
.Global = True
End With
For Each ws In ActiveWorkbook.Worksheets
str = ws.Name
Debug.Print regex.Test(str)
Next ws
|