in reply to Re: test if a string contains a list member
in thread test if a string contains a list member

Depending on the needs, this method is a bit too strict, as it will reject even compound words that contain a offensive word as a subword.

A way that could also be worked around, but which would create less false positives, would be to make sure each offensive word is used as a word alone :

my $badwordsRE = "\\b" . join( "\\b|\\b", @badwords ) . "\\b"; reject if /$badwordsRE/o;

My advice to the original poster is to get a list of offensive words from the web master administrator or some other person responsible for that thing and use that list as a ban list - so he is clean with them. If there is no such list, then I wouldn't censor at all.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Replies are listed 'Best First'.
Re: Re: Re: test if a string contains a list member
by jj808 (Hermit) on Oct 20, 2001 at 22:13 UTC
    It might be a good idea to use the /i modifier as well - it's OK to block 'smurf' and 'fork', but what about 'SMURF'...

    Cheers,

    JJ