RE: [PHP] Eregi error
| From: | Peter Lauri | Date: | Thu, 01 Mar 2007 05:17:29 +0000 |
| Subject: | RE: [PHP] Eregi error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249640@lists.php.net to get a copy of this message | ||
Not sure, but I don't think you should escape all those characters inside of
the character class. I might be wrong. However, that might not have anything
to do with the error. But I do think you need to escape the / in the end...
And the - you should have in the beginning of the character class, otherwise
it will be treated as a range.
Best regards,
Peter Lauri
www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free
-----Original Message-----
From: Brad [mailto:brad@trueguava.com]
Sent: Thursday, March 01, 2007 5:09 AM
To: PHP Mailing
Subject: [PHP] Eregi error
Hey all,
I have been having some trouble with the "eregi" function. I have the
following piece of code in my application:
function standard_input($input, $min=0, $max=50){
if (strlen($input) <= $max and strlen($input) >= $min ) {
$pattern = '^[a-z0-9\!\_ \.- ,/]*$';
if(!eregi($pattern, $input)){
return false;
}else{
return true;
}
}else{
return false;
}
}
And i am running PHP version 5.2.1
I receive the following error:
*Warning*: eregi() [function.eregi
<http://idontwanttouse.net/MeetMyMate/Bin/Debug/function.eregi>]:
REG_ERANGE in *[File Location]* on line *287
*Any ideas what might cause this? Googling REG_ERANGE only showed more
questions.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php