RE: [PHP] Inane ereg problem

From: Date: Tue, 25 Jul 2000 00:29:45 +0000
Subject: RE: [PHP] Inane ereg problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7976@lists.php.net to get a copy of this message
> $excludeChars="\[\*\.\-\+\{\}\%\\$\|\#\@"; > $text="when in t[he course of human events"; > > if(ereg("([$excludeChars])",$text)){ > > Print("bad characters\n"); > > $letters=implode(" ",explode("\\",$excludeChars)); > print($letters); Try this. The right square bracket should be the first in the sequence and the hyphen the last. $excludeChars = ']*.+{}%$|#@\\-'; if(ereg('['.$excludeChars.']', $text)){ echo 'Bad Chars'; } -- Richard Heyes http://www.heyes-computing.net/scripts/ Plain text email only please!

« previous php.general (#7976) next »