Re: Regex help
| From: | Richard Lynch | Date: | Fri, 28 Jan 2005 22:47:36 +0000 |
| Subject: | Re: Regex help | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207646@lists.php.net to get a copy of this message | ||
kjohnson@zootweb.com wrote:
> OK, this is off-topic like every other "regex help" post, but I know some
> of you enjoy these puzzles :)
>
> 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.
$text = $_REQUEST['text'];
if (strlne($text) < 42 && !strstr($text, '&&')){
//kosher
}
else{
trigger_error("Invalid input", E_USER_ERROR);
}
Oh, wait, that's not Regex. Oh well. Too bad.
--
Like Music?
http://l-i-e.com/artists.htm