Re: Regular Expression for a UK Mobile

From: Date: Fri, 15 Oct 2004 12:07:31 +0000
Subject: Re: Regular Expression for a UK Mobile
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-199578@lists.php.net to get a copy of this message
On Fri, 2004-10-15 at 07:45, Gareth Williams wrote: > Do you even need a regex? > > What about > > if (strlen($_POST['mobile_number']) != 11 && > substr($_POST['mobile_number'],0,3) != 447) > { > $error="Invalid Number"; > } This doesn't verify that the portion following 447 is also a number. eg. 4474567X901 Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#199578) next »