Re: Regular Expression for a UK Mobile

From: Date: Fri, 15 Oct 2004 11:45:53 +0000
Subject: Re: Regular Expression for a UK Mobile
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-199576@lists.php.net to get a copy of this message
Do you even need a regex? What about if (strlen($_POST['mobile_number']) != 11 && substr($_POST['mobile_number'],0,3) != 447) { $error="Invalid Number"; } On 15 Oct 2004, at 13:38, Shaun wrote:
Hi, Could anyone help me with a reugular expression for a UK mobile phone number? So far I have tried this but with no success <snip> $regexp = "/^447[0-9]{9}$/"; if(!preg_match( $regexp, $_POST[mobile_number] )){
     $error = "Invalid Mobile Number";
</snip> The number nust be 11 numbers long, be all numbers, have no spaces and begin with 447. Any help would be greatly appreciated... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#199576) next »