Re: Regex help - PLease

From: Date: Tue, 16 Mar 2004 12:48:10 +0000
Subject: Re: Regex help - PLease
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-180537@lists.php.net to get a copy of this message
Hello Brent, Tuesday, March 16, 2004, 12:39:27 PM, you wrote: BC> im in desperate need of help for a reg expression to ONLY allow 8 BC> NUMBERS to start with 100 and may not have any other kind of BC> letters or characters. Only numbers BC> for example BC> 10064893 It's not a reg exp, but it will work: if (is_numeric($val) == FALSE || strlen($val) <> 8 || substr($val, 0, 3) !== "100") { // $val doesn't match } Conversely: if (is_numeric($val) == TRUE && strlen($val) == 8 && substr($val, 0, 3) == "100") { // $val does match } (Code not tested, but you get the idea I hope) -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html

« previous php.general (#180537) next »