Re: Eregi error

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

 



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.

-- 
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