in reply to Can this be a 1 line or simpler regex?
Yes, though you might want to lay this out over two lines.
s{([\t\n\r\f])}{ local $_= '\\' . $1; tr[\t\n\r\f][tnrf]; $_ }eg
Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Can this be a 1 line or simpler regex? (slightly better?)
by Aristotle (Chancellor) on Apr 06, 2003 at 02:23 UTC | |
by BrowserUk (Patriarch) on Apr 06, 2003 at 04:13 UTC | |
by diotalevi (Canon) on Apr 06, 2003 at 02:40 UTC | |
by Aristotle (Chancellor) on Apr 06, 2003 at 11:49 UTC | |
by diotalevi (Canon) on Apr 06, 2003 at 17:43 UTC |
In Section
Seekers of Perl Wisdom