![]() |
|
#1
|
|||
|
|||
![]()
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
__________________
Using O365 v2503 - 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 |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |
![]() |
tinfanide | Excel Programming | 4 | 05-30-2012 04:09 AM |