texuser74 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to do the following find and replace
this line of code works fine and does the jobinput: <it>a</it>+2<it>b</it><inf><it>cd</it></inf> <it>a</it>+2<it>b</it><sup><it>cd</it></sup> output: <it>a</it>+2<it>b<inf>cd</inf></it> <it>a</it>+2<it>b<sup>cd</sup></it>
but i want to make it dynamic so i changed it as follows and this way it is not workings!</it><inf><it>(.*?)</it></inf>!<inf>$1</inf></it>!g; s!</it><sup><it>(.*?)</it></sup>!<sup>$1</sup></it>!g;
please let me know whether i can use $1 in find string and if yes how to use its!</it><(.*?)><it>(.*?)</it></$1>!<$1>$2</$1></it>!g;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: using $1 as find string
by bmann (Priest) on Dec 29, 2004 at 04:34 UTC | |
|
Re: using $1 as find string
by gopalr (Priest) on Dec 29, 2004 at 05:16 UTC | |
by texuser74 (Monk) on Dec 29, 2004 at 06:50 UTC | |
|
Re: using $1 as find string
by nedals (Deacon) on Dec 29, 2004 at 04:03 UTC | |
|
Re: using $1 as find string
by revdiablo (Prior) on Dec 29, 2004 at 19:22 UTC |