[thelist] RegExp: new weird problem
Joshua Olson
joshua at waetech.com
Fri Sep 12 09:43:02 CDT 2003
----- Original Message -----
From: "Tab Alleman" <Tab.Alleman at MetroGuide.com>
Sent: Friday, September 12, 2003 10:20 AM
> Ok, now my pattern looks like this:
> ^PER NIGHT STARTING|ON [0-9]{1,2}\s?[A-Z]{3}[0-9]{0,4} FOR (\d{1,2})
> NIGHTS?$
Tab,
The | is basically breaking your regex and half and indicating that it can
match either
^PER NIGHT STARTING
or
ON [0-9]{1,2}\s?[A-Z]{3}[0-9]{0,4} FOR (\d{1,2}) NIGHTS?$
You'll need to wrap the STARTING|ON in (). Eg:
^PER NIGHT (STARTING|ON) [0-9]{1,2}\s?[A-Z]{3}[0-9]{0,4} FOR (\d{1,2})
NIGHTS?$
That tells the parser that either STARTING or ON can be in that spot in the
string.
HTH,
<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168
More information about the thelist
mailing list