$line= <<END; 10 PRINT "<29>This is dim.<30>EThis is reversed.<28>This is bold.<27>" END my %fix= ( "<29>" => '@(-38)', "<28>" => '@(-40)', "<27>" => '@(-35)' ); my $pattern = join("|", map "(?:$_)", keys %fix); 1 while $line =~ s/("[^"]*) ($pattern) (.*?")/$1";$fix{$2};"$3/gx; $line =~ s/"";//g; $line =~ s/;""//g; print $line;
In reply to Re: Smart Search and Replacement with RegEx
by sfink
in thread Smart Search and Replacement with RegEx
by shelob101
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |