[thelist] RegExp: new weird problem

Tab Alleman Tab.Alleman at MetroGuide.com
Fri Sep 12 09:20:41 CDT 2003


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?$

Because sometimes I'll get input that looks like this:  "PER NIGHT
STARTING 05 MAR FOR 4 NIGHTS"
And sometimes it looks like this:  "PER NIGHT ON 05MAR03 FOR 3 NIGHTS"

So the change from yesterday is that I've added the "STARTING|ON", and
the [0-9]{0,4} to catch the possibility that a year will come after the
month.

But when I try to match:  "PER NIGHT STARTING 22 MAR FOR 5 NIGHTS", 
The only part that matches is: "PER NIGHT STARTING"

Why?  Did I not do the "STARTING|ON" correctly?  The pattern matches
correctly to "PER NIGHT ON 05MAR03 FOR 3 NIGHTS"


More information about the thelist mailing list