in reply to Replace only unescaped metachars
Ikegami points out that the (?:\\) can just be \\.my $str = 't?e\\\\xt\\\\* with escapes\\*'; my %swap; @swap{'?','*'} = ('#','?'); $str=~s/((?:\\)(.)|\?|\*)/$swap{$1}||$2/ge; print ">>$str<<\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replace only unescaped metachars
by Anonymous Monk on Feb 23, 2007 at 08:02 UTC | |
by ikegami (Patriarch) on Feb 23, 2007 at 17:47 UTC |