Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-20-2018, 08:06 AM
davidlooney davidlooney is offline Regular Expressions Windows 7 32bit Regular Expressions Office 2016
Novice
Regular Expressions
 
Join Date: Jul 2018
Posts: 1
davidlooney is on a distinguished road
Default 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
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expressions 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 Regular Expressions: [!0-9] does not work??? tinfanide Excel Programming 4 05-30-2012 04:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft