Re: Eregi error

From: Date: Thu, 01 Mar 2007 22:04:13 +0000
Subject: Re: Eregi error
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-249677@lists.php.net to get a copy of this message
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.

« previous php.general (#249677) next »