in reply to Match first word in line fails

This might help:

use Regexp::Common qw(profanity); my %bad2good = (...); while(<>) { s/($RE{profanity})/$bad2good{lc $1}/gi; print; }

You'll have to come up with your own bad word replacement list. If the regexp doesn't work for you as is, you can either edit the module as you like, or submit a bug report.