Thread: RegExp
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arshavir Grigorian Arshavir Grigorian is offline
external usenet poster
 
Posts: 10
Default RegExp

Hi,

I am using Microsoft VBScript RegExp 5.5 within VBA for Excel.

http://msdn2.microsoft.com/en-us/lib...ka(VS.85).aspx

"Matches pattern and remembers the match. The matched substring can be
retrieved from the resulting Matches collection, using Item [0]...[n].
To match parentheses characters ( ), use "\(" or "\)"." - from the
docs on the above page.

I am wondering if anyone could give me an example of using the Item
array to retrieve clustered matches. Like so:

regEx.Pattern = ".*(\d{1,2})Y.*"

I need to match one or two digits followed by 'Y', but I only need to
get the digits. In regEx.Replace() I would use $1 to access the first
cluster (the match inside the innermost set of parens), but I am not
sure how to do it with regEx.Execute().

Thanks.