This works for me:
Though I wish I could use return. (: - tye (but my friends call me "Tye")$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)' ); $line =~ s{("?)(<\d+>)("?)}{ if( "<30>" eq $2 ) { "$1$2$3" } else { my $str= $1 ? "" : '";'; $str .= $fix{$2}; $str .= $3 ? "" : ';"'; $str; } }gex; print $line;
In reply to (tye)Re: Smart Search and Replacement with RegEx
by tye
in thread Smart Search and Replacement with RegEx
by shelob101
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |