Re: ICQ # validation

From: Date: Mon, 03 Mar 2003 19:06:14 +0000
Subject: Re: ICQ # validation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137949@lists.php.net to get a copy of this message
Use single quotes around your pattern. if(ereg('^[0-9]{7,9}$',... With the double quotes, PHP is probably seeing the $ and looking for a variable, even though it's at the end of the string. ---John Holmes... ----- Original Message ----- From: "Liam Gibbs" <liamgibbs@sympatico.ca> To: <php-general@lists.php.net> Sent: Monday, March 03, 2003 2:00 PM Subject: [PHP] ICQ # validation Maybe I'm off my rocker, but I don't see how this can't work. I'm trying to validate an ICQ number, and assuming a valid one is between 7 and 9 numbers. My line of code is this: if(ereg("^[0-9]{7,9}$", $_REQUEST["icqnumber"])) { print("a-okay!"); } else { print("error msg"); } I've submitted the ICQ # 2264532680, but it validates. Any ideas?

« previous php.general (#137949) next »