View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Scott Scott is offline
external usenet poster
 
Posts: 87
Default Regular Expression for cell address

I'd actually have to read up on VBA Regex, so I'll leave the
explanation to someone with a working understanding.

Your second part... that is not going to work like you want it to.

([A-Za-z]|[A-Za-z][A-Za-z]|[Ii][A-Va-v]) allows ZZ

You probably meant:
([A-Za-z]|[A-Ha-h][A-Za-z]|[Ii][A-Va-v])

Scott

M. Authement wrote:
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!