The \b switch matches on word boundaries, \W matches on non word charachter, and \s matches whitespace (and of course you could match spaces. I would use \b (unless you want to do something else, because \s and \W will get substituted out), i.e.:
$sometext =~ s[\ba--\b][***]sgi;
Also don't forget the i switch (so A-- doesn't go under the radar -- it does case insensitive)
In reply to Re: regex for swear filter
by Vautrin
in thread regex for swear filter
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |