#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
Hi and welcome
please wrap code with code tags (#button) Thanks
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
regular expressions in footnotes | loes | Word | 3 | 09-04-2019 07:52 AM |
Regular expressions and field codes | Cosmo | Word VBA | 5 | 04-20-2018 04:10 PM |
Word Regular Expressions: zero or more occurences? | tinfanide | Word | 6 | 09-16-2015 03:13 PM |
regular expressions for empty lines | eNGiNe | Word | 1 | 01-21-2013 06:38 AM |
Regular Expressions: [!0-9] does not work??? | tinfanide | Excel Programming | 4 | 05-30-2012 04:09 AM |