# Now its starting to get ugly! $str =~ s#((?i:$1!#eg;