Friday, August 20, 2010

UK telephone regex for PHP

PHP regex for UK telephone number:
if(preg_match ('/^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/', $string)) {
//do whatever
}
Can't remember where I got this from, if I do I will post link.

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home