[thelist] RegExp: new weird problem

Dougal Campbell dougal at gunters.org
Fri Sep 12 10:17:57 CDT 2003


On Fri, 12 Sep 2003, Tab Alleman wrote:

> Argh, I found that changing my pattern to:
>
> ^PER NIGHT (ON|STARTING) [0-9]{1,2}\s?[A-Z]{3}[0-9]{0,4} FOR (\d{1,2})
> NIGHTS?$
>
> Fixes the problem, but it means that I have to return "STARTING" or "ON"
> as a submatch, and I don't wanna.  Do I hafta, or is there another way?

There's always another way. Maybe not a *pretty* way....

  ^PER NIGHT [ONSTARIG]{2,8} [0-9]{1,2}\s?[A-Z]{3}[0-9]{0,4} FOR (\d{1,2}) NIGHTS?$

The downside of that being that it could match other words besides ON or
STARTING. You could use [A-Z]{2,8}, but that would have even more
potential for matching unwanted words.

-- 
Ernest MacDougal Campbell III, MCP+I, MCSE <dougal at gunters.org>
http://dougal.gunters.org/             http://spam.gunters.org/
  Web Design & Development:  http://www.mentalcollective.com/
       This message is guaranteed to be 100% eror frea!


More information about the thelist mailing list