LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 553
Default How do you look for two distinct patterns (RegExp)

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
distinct andifak Excel Worksheet Functions 1 September 12th 07 01:42 PM
Distinct Vipul Dani Excel Worksheet Functions 4 July 11th 06 07:56 AM
Regexp needed in Excel 2000 Mr. Me Excel Discussion (Misc queries) 14 August 2nd 05 08:01 PM
pattern matching w/o using VBScript's RegExp Object Tim Williams Excel Programming 0 March 7th 05 09:19 PM
Distinct Value With Countif spalmarez Excel Worksheet Functions 4 November 6th 04 07:30 AM


All times are GMT +1. The time now is 01:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"