Re: Regex help

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

 



On 28 Jan 2005 kjohnson@xxxxxxxxxxx wrote:

> I need a validation regex that will "pass" a string. The string can be no 
> longer than some maximum length, and it can contain any characters except 
> two consecutive ampersands (&) anywhere in the string.

This is an example of something that is easier to do (and probably 
faster) without using a regexp:

	if ((strlen($str) <= $maxlen) && (strstr($str, '&&') === FALSE))
		<str is valid>
	else
		<str is not valid>

--
Tom

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