Re: Help w/ regular expressions for banned words

From: Date: Sat, 20 Jan 2001 19:14:07 +0000
Subject: Re: Help w/ regular expressions for banned words
Groups: php.general 
Request: Send a blank email to php-general+get-35831@lists.php.net to get a copy of this message
No, it didn't work. I've tried [:space:]$bannedwords[$i][:space:], \<$bannedwords[$i]\>, and \b$bannedwords[$i]\b. It doesn't detect anything. I'm reading a list of banned words out of a text file and putting them into $bannedwords. I'm pretty sure $bannedwords is right, since I've tried stuff like "test" (detected), "\<test\>" (not detected), "[:space:]test[:space:]" (not detected). And, in all times, I use the syntax like this: $string = eregi_replace("a","[censored]",$string); So I'm sure the syntax is right. Thanks for your help, though. --Neal ------------------- did it work? ----- Original Message ----- From: Team JUMP <lists@jumpinternet.com> To: <php-general@lists.php.net> Sent: Saturday, January 20, 2001 12:35 PM Subject: Re: [PHP] Help w/ regular expressions for banned words Thanks for your help. Unfortunately, [:space:]$bannedwords[$i][:space:] would not work, since I need to also check for the first and last word. In a last-case scenario I could write special code for the first and last word, but that may get ugly with bug-checking... but I've already tried "\s+$bannedwords[$i]\s+" to no avail. I believe [:space:] is just a substitute for \s+, right? Yeah, I've tried \<$bannedwords[$i]\> too, unfortunately. Like I said before, eregi_replace("a","[censored]",$string) makes a match, but eregi_replace("\<a\>","[censored]",$string) or eregi_replace("\ba\b","[censored]",$string) does not. Most odd. Thanks for your help, though. Anyone else have suggestions? --Neal

« previous php.general (#35831) next »