in reply to Smart Search and Replacement with RegEx
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Smart Search and Replacement with RegEx
by sfink (Deacon) on May 29, 2002 at 18:59 UTC | |
|
Re: (tye)Re: Smart Search and Replacement with RegEx
by shelob101 (Sexton) on May 31, 2002 at 02:36 UTC |