Re: Regular Expression

From: Date: Thu, 05 Aug 2004 02:35:36 +0000
Subject: Re: Regular Expression
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-35581@lists.php.net to get a copy of this message
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}$ 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 10:22 AM Subject: Re: [PHP-DB] Regular Expression > Ng Hwee Hwee wrote: > > > Hi all, > > > > I somehow just couldn't get my regular expression syntax correct. Will you please help me? > > > > some examples of my valid string is: > > sinx0401-001-45 > > hkgx0403-020-12 > > jktx0402-000-01 > > bkkx0407-013-44 > > > > the definition is: > > 1st 4 characters - can only be "sinx" or "hkgx" or "bkkx" > > or "jktx" > > next 4 characters - numbers 0 to 9 > > next 1 character - a dash "-" > > next 3 characters - numbers 0 to 9 > > next 1 character - a dash "-" > > last 2 characters - numbers 0 to 9 > > (sin|hkg|bkk|jkt)x[0-9]{4}-[0-9]{3}-[0-9]{2} > > -- > > John Holmes

« previous php.db (#35581) next »