Re: Regular Expression

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

 



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

--
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