use strict; use warnings; my $str = " text with';*()/? nasty chars. scripted should be ok, but not script"; print cleanup($str); sub cleanup { $_[0]=~tr|<>;()"'?/*||d; $_[0]=~s/\bscript\b//g; return $_[0]; } #### some text with nasty chars. scripted should be ok, but not