Re: Regular Expression
| From: | Ng Hwee Hwee | Date: | Thu, 05 Aug 2004 03:08:31 +0000 |
| Subject: | Re: Regular Expression | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35583@lists.php.net to get a copy of this message | ||
thanx a million!! you really saved my day!! :o)
hwee
----- Original Message -----
From: "John Holmes" <holmes072000@charter.net>
To: "Ng Hwee Hwee" <hhwee@towa.com.sg>
Cc: "PHP DB List" <php-db@lists.php.net>
Sent: Thursday, August 05, 2004 11:05 AM
Subject: Re: [PHP-DB] Regular Expression
> Ng Hwee Hwee wrote:
> >>(sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2}
> >
> > thanx!!! it worked like a charm! =)
> >
> > just a question, i've tried adding a ^ to the front of your expressions
and
> > a $ to the end of your expression and it still worked.. but is it
> > recommended? why didn't you use them?
> >
> > ^(sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2}$
>
> Yeah, you should use them to ensure that the text is _only_ that code
> and not just contains it. Otherwise "asdf sinx1234-123-12 asdf" will
> pass. I just forgot. :)
>
> --
>
> John Holmes
>
> php|architect - The magazine for PHP professionals -
http://www.phparch.com
>