Re: Eregi error
| From: | Myron Turner | Date: | Thu, 01 Mar 2007 18:32:17 +0000 |
| Subject: | Re: Eregi error | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249667@lists.php.net to get a copy of this message | ||
M.Sokolewicz wrote:
the problem is that the hyphen is interpreted as regex range operator: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
[a-z0-9\!\_ \.- ,/]Rewrite this as
[a-z0-9\!\_ \. ,/-]with the hyphen in the last position. -- _____________________ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/