PinoyTech.org

CodeIgniter, Kohana, Mootools, jQuery and CSS

How to Validate Philippine Cellphone Numbers via Regular Expressions

Posted by teejay on March 18, 2009

I was once given this test in a company I applied as a PHP programmer for. Thanks to a few minutes on Rubular and some studying, I finally got the answer.

Globe Mobile Numbers:

^(0905|0917|0916|0905|0915){1}\d{7}$

Smart Mobile Numbers:

^(0919|0917|0916|0905|0915){1}\d{7}$

Sun Cellular Mobile Numbers:

^(0922|0923){1}\d{7}$

There's probably a better way to do this :|

Categories: How To

Tags: regular expressions

No Comments

Comments are not allowed