Re: Regular Expression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

php|architect - The magazine for PHP professionals - http://www.phparch.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux