Re: regexp to match simple text not working
On Fri, 20 Jun 2008 21:08:24 +0200, Raistlin Majere <pedbessa@gmail.com>
wrote:
> define('VALID_MESSAGE', '/^[a-zA-Z0-9 ,.!?\n]{1,10000}$/');
> // it accepts
> testtesttesttesttesttest
>
> // it refuses
> testtest
> testtest
> testtest
Most likely, because of \r.
An obvious solution would be:
define('VALID_MESSAGE','/^[a-z0-9,.!?\s]{1,10000}$/i');
Allthough I'd rather use a (mb_)strlen() & '/^[a-z0-9,.!?\s]+$/i' for some
reason. I have no idea wether that's more efficient or not, or even why I
prefer it...
--
Rik Wasmus
....spamrun finished
|