Re: Regular Expression

From: Date: Thu, 05 Aug 2004 03:05:23 +0000
Subject: Re: Regular Expression
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-35582@lists.php.net to get a copy of this message
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

« previous php.db (#35582) next »