in reply to prohibiting certain strings

Drop the nonword characters, and try again.
$input = "There's the b/a/d/w/o/r/d."; (my $test = $input) =~ s/\W+//g; if($test =~ /badword/) { print "You sneaky devil!\n"; }

Replies are listed 'Best First'.
Re^2: prohibiting certain strings
by ptum (Priest) on Dec 28, 2005 at 23:39 UTC

    Of course, that still leaves 'badw0rd' and 'b_a_d_w_o_r_d', but it is a start. I would be more restrictive:

    (my $test = $input) =~ s/[^A-Z]//ig;

    This will still permit 'baaadwooord', unfortunately.

    I'm inclined to agree with [id://phaylon], in that there is no substitute for moderation. :)

    Update: forgot the ^ character. <blush>