[thelist] RegExp: extracting a substring

Tab Alleman Tab.Alleman at MetroGuide.com
Thu Sep 11 13:34:43 CDT 2003


Ok, so I've got my regexp pattern:

"^PER NIGHT STARTING [0-9]?[0-9]\b?[A-Z][A-Z][A-Z] FOR (\d{1,2})
NIGHTS?$"

And I want to get the value of (\d{1,2}) when I find a match.  In other
words, "how many nights?"  The lengths of the delimiters can vary, so I
don't see how I can use Mid() to parse it out.  I thought RegExp's were
supposed to be able to get just what is in the parenthesis, but
apparently that's not the case.  What's the point of putting things in
parenthesis anyway?

Anyway, anybody have any idea how I can get the value of (\d{1,2}) for
each match?


More information about the thelist mailing list