$s='III...MMMMMOOOO....MMMIIII'; print $s."\n"; %neg = ( O => "I", I => "O" ); $s=~s/([IO])(M*)(\.+)/ $1.$2.( $neg{$1} x length($3) ) /eg; $s=~s/(\.+)(?=M*([IO]))/ $neg{$2} x length($1) /eg; print $s;print "\n"; <code> It prints:<br> <code> III...MMMMMOOOO....MMMIIII IIIOOOMMMMMOOOOIIIIMMMIIII
In reply to Re^4: How to make these reg exp changes?
by Anonymous Monk
in thread How to make these reg exp changes?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |