$a = "<exp>2a+α-b2+bβ2</exp><br>"; $a =~ s#(<exp>)(.*?)(<\/exp>)#$1.&expr($2).$3#egsi; print $a; sub expr { my($a) = @_; $a =~ s#([A-Z])#<it>$1</it>#gsi; $a =~ s#(\&)(.*?)(\;)#$1.&tmp($2).$3#egsi; sub tmp { my($tmp) = @_; $tmp =~ s#(<it>|<\/it>)##gsi; return $tmp; } return $a; }
o/p : <exp>2<it>a</it>+α-<it>b</it>2+<it>b</it>β2</exp>
Gubendran.L
In reply to Re: find and replace
by gube
in thread find and replace
by texuser74
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |