mt2k has asked for the wisdom of the Perl Monks concerning the following question:
Example:
How would I go about changing $string so that only the \n's between the <TAG> and </TAG> tags become <BR> tags. Meaning that in the end, $string would hold:$string = " hello <tag> code goes here </tag> more text ";
My attempt would be something like:$string = " hello <tag><br>code<br>goes here<br></tag> more text ";
but I know that $1, $2, etc. are read-only.... Help!$string =~ s/<tag>(.*?)<\/tag>/$1 =~ s/\n/<br>/gs;/ieg;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Editting Part of Regex
by chipmunk (Parson) on Mar 08, 2001 at 19:44 UTC | |
|
Re: Editting Part of Regex
by mirod (Canon) on Mar 08, 2001 at 19:55 UTC | |
|
(sacked: substr) Re: Editting Part of Regex
by sacked (Hermit) on Mar 08, 2001 at 22:25 UTC |