How do you look for two distinct patterns (RegExp)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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
.



Relevant Pages

  • Re: How do you look for two distinct patterns (RegExp)
    ... I'm not too sure about your pattern.. ... e.g. a ref to book.xls!MyName is not caught.. ... If oRE Is Nothing Then ... > What is the proper syntax for passing more than one string to the ...
    (microsoft.public.excel.programming)
  • Learning patterns... Decorator
    ... I'm trying to learn patterns, which I hope to use in my PHP code, although I'm finding it hard to get any real impression of how patterns fit in properly, I've done the following test code for Decorator pattern and want to know: ... public function getName; ... class CProduct implements IProduct { ...
    (comp.lang.php)
  • Tough questions
    ... have come up in the mocks which are confusing: ... allows you to overload an instance of an object so it can be accessed ... The following PHP script is an example of which design pattern? ... public function __construct{ ...
    (alt.php)