in reply to Robust Anti-Swear script
You could try "laundering" the text on its way in, rather than writing really complicated regexps. In other words, first render it in lowercase, remove all whitespace and punctuation, make substitions for l337 speak, then look for the nasties. It's fairly easy with tr:
(Warning, this is untested.) Of course you could combine those into a single statement. I just broke it up for clarity.$message = uc $message; # uppercasify $message =~ tr/ .;,/d; # remove spaces and punctuation $message =~ tr/13457/least/; # un-1337
Do realize that the more munging you do in this fashion, the more prone your code will be to false positives. For example, the sample lines I wrote above would trigger on "I had amnesia" and "45 sweaters".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (2): Robust Anti-Swear script
by RatArsed (Monk) on Jul 31, 2001 at 12:39 UTC | |
|
Re: Re: Robust Anti-Swear script
by Azhrarn (Friar) on Jul 31, 2001 at 00:45 UTC | |
by elwarren (Priest) on Jul 31, 2001 at 01:30 UTC | |
by mischief (Hermit) on Jul 31, 2001 at 18:21 UTC | |
by elwarren (Priest) on Jul 31, 2001 at 23:15 UTC |