(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 reply to Re: Can this be a 1 line or simpler regex?
by diotalevi
in thread Can this be a 1 line or simpler regex?
by smackdab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |