Re: Eregi error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roberto Mansfield wrote:
Myron Turner wrote:
M.Sokolewicz wrote:
           $pattern = '^[a-z0-9\!\_ \.- ,/]*$';
           if(!eregi($pattern, $input)){
the problem is that the hyphen is interpreted as regex range operator:
                                         [a-z0-9\!\_ \.- ,/]
Rewrite this as
                                   [a-z0-9\!\_ \. ,/-]
with the hyphen in the last position.


Or just escape the hyphen: \-
The position won't matter.


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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux