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";
In reply to Re: Replace only unescaped metachars
by Roy Johnson
in thread Replace only unescaped metachars
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |