$string =~ s/!([\w\s]+)//; ##add other allowed chars as needed #### $string =~ s/!([\w\s\!\@\#\$\%\^\&\*\(\)\\\`\~\-\+\=\,\.]+)//;