Re: Eregi error
| From: | Myron Turner | Date: | Fri, 02 Mar 2007 00:14:11 +0000 |
| Subject: | Re: Eregi error | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249696@lists.php.net to get a copy of this message | ||
Roberto Mansfield wrote:
Myron Turner wrote:Actually, I tried that, but it didn't work. It still saw the hyphen as an operator. The other thing about this is that the hyphen is followed by a space, so that it's asking for a range between the period and the space, which you can't do, since the space character has a lower ascii value than than the period. The space is more obvious in a monospaced font. -- _____________________ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/M.Sokolewicz wrote:Or just escape the hyphen: \- The position won't matter.Rewrite this asthe problem is that the hyphen is interpreted as regex range operator: [a-z0-9\!\_ \.- ,/]$pattern = '^[a-z0-9\!\_ \.- ,/]*$'; if(!eregi($pattern, $input)){[a-z0-9\!\_ \. ,/-]with the hyphen in the last position.