View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default Regular Expression for cell address

(?:[\^\])-/+*:,="[(])

Hi believe brackets capture any of the items within [ ??? ].
In general, (?: __ ) is a subexpression that matches pattern, but does not
capture the match for use later on. (ie looking at a formula =Sum(..) )

I'm not to sure of the last on. ([^\d]|$)
$ usually matches the position at the end of the string.
| is "Or"
[^\d] is a non-digit, but could have been written as \D.
Again, not too sure on that one. ??

--
Dana DeLouis
Windows XP & Office 2003


"M. Authement" wrote in message
...
Can someone explain this regular expression to me? I found it in some VBA
code for finding/altering a cell address within a string. I put spaces in
to break the expression apart into the parts (I think) I understand.

(?:[\^\])-/+*:,="[(]) (\$?) ([A-Z]{1,2}) (\$?) (\d{1,5}) ([^\d]|$)

The second and fourth part are the optional absolute/relative dollar sign,
the third part is the one or two character column, and the fifth part is
the 1 to 5 digit row number.

What are the first and last parts of this expression?

Is there a more robust way to designate the row number as 1-65536?

What about the column designation? I was thinking something like
([A-Za-z]|[A-Za-z][A-Za-z]|[Ii][A-Va-v]). This allows for lower case
letters and avoids the possibility of columns greater than IV.

I am new to regular expressions, having read an online tutorial, so any
references to sources of help are also appreciated. Thanks in advance for
your help!