my $text = 'Goodbye\; Good luck\, and thanks for all the fish!\\n\\n'; $text =~ s{ \\ ([^n]) } {$1}xmsg; print "-->$text<--"; --output:-- -->Goodbye; Good luck, and thanks for all the fish!\n\n<--