in reply to Can this be a 1 line or simpler regex?
(fixed the code)
I suppose a single regex could be devised for this but it'd be suboptimal compared to what you already have. A short loop would also do this and again, I prefer your original.
$text =~ s/\\$r/\\\\$r/g for qw/t n r f/;for(qw't n r f') { my $r = "\\$_"; $text =~ s/$r/$r/g; }
In Section
Seekers of Perl Wisdom