[PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread Shaun
Hi, I am trying to create a regular expression for a mobile phone number. The number must be 12 digits long(0-9) and begin with 447 and have no spaces. So far I have come up with this but it keeps telling me the number is invalid even when its correct! $regexp = /447[0-9]{9}/;

Re: [PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread Michal Migurski
I am trying to create a regular expression for a mobile phone number. The number must be 12 digits long(0-9) and begin with 447 and have no spaces. So far I have come up with this but it keeps telling me the number is invalid even when its correct! Try this: $regexp = /447[0-9]{9}/;

Re: [PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread Shaun
Michal Migurski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am trying to create a regular expression for a mobile phone number. The number must be 12 digits long(0-9) and begin with 447 and have no spaces. So far I have come up with this but it keeps telling me the number is

Re: [PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread Jochem Maas
you should also be considering spaces, leading zeros, brackets, dashes international notation. /^(((\+|00)[- ]?[0-9]{2,3}[- ]?(\(0\))?[- ]?[1-9]{1}[0-9]{1,})|(0[1-9]{1}[0-9]{1,}))[- ]?(([0-9]{7,})|([0-9]{3}[ -]{1}[0-9]{4}))$/ line-wrapping is unintentional, no garantees as to how good it is.

Re: [PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread Shaun
Thanks for your reply, but the number cannot be out side the UK or contain spaces, leading zeros, brackets or dashes Jochem Maas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] you should also be considering spaces, leading zeros, brackets, dashes international notation.

Re: [PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread Michal Migurski
but the regular expression still seems to reject the number... Can you provide an example of numbers it rejects? My answer was based on the simple fact that you were testing for numbers that matched, and returning a rejection based on that. The regexp is simple enough -- some examples of input

Re: [PHP] Regular Expression for a UK mobile phone number

2004-04-08 Thread gohaku
On Apr 8, 2004, at 2:40 PM, Shaun wrote: Thanks for your reply Michal, but the regular expression still seems to reject the number... Just out of curiosity, Have you tried if(stripslashes(htmlentities($_POST[mobile_number]) ) != ) ? -- PHP General Mailing List (http://www.php.net/) To