How do you look for two distinct patterns (RegExp)
- From: "ExcelMonkey" <ExcelMonkey@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 7 Aug 2005 12:32:02 -0700
I have a regular expression with defined pattern. How do I incorporate
another pattern. That is, I want to evalute both the pattern in the code
below AND OR a second pattern:
\=[.+\].+\!
What is the proper syntax for passing more than one string to the pattern
property. I want to say look for X AND OR Y.
Public Function CellHasWhatIAmLookingFor(rng As Range) As Variant
Dim reg As Object
'On Error GoTo ErrHandler
If rng.HasFormula Then
Set reg = CreateObject("VBScript.RegExp")
With reg
.Pattern = "\=.+\[.+\].+\!.+" 'also want \=[.+\].+\!
CellHasExternalLinks = .test(rng.Formula)
End With
Else
CellHasExternalLinks = False
End If
End Function
.
- Follow-Ups:
- Re: How do you look for two distinct patterns (RegExp)
- From: keepITcool
- Re: How do you look for two distinct patterns (RegExp)
- Prev by Date: RE: Help in writing an Excel equation
- Next by Date: Re: Safeguarding Excel Products from Piracy
- Previous by thread: Help in writing an Excel equation
- Next by thread: Re: How do you look for two distinct patterns (RegExp)
- Index(es):
Relevant Pages
|