Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2014, 08:52 AM
tinfanide tinfanide is offline RegExp: Windows 7 64bit RegExp: Office 2010 32bit
Expert
RegExp:
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default RegExp:

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.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
RegExp: VBScript.RegExp: exclude a particular word tinfanide Excel Programming 2 06-07-2012 06:52 AM
RegExp: WORD: Rtf and search-replace (regexp/fonts) seteshpl Word 1 09-06-2011 01:35 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:18 AM.


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