dalegribble has asked for the wisdom of the Perl Monks concerning the following question:
I'm modifying the regular expressions for a function that replaces less than, greater than, and ampersand characters in an xml data string with their html equivalents. The test code that I'm currently using is:
my $str = '<Data1>Data</Data1><Data2></Data2><Data3> < </Data3>'; $str =~ s/>(.*?)<(.*?)<\//>$1<$2<\//g;
My desired output is:
<Data1>Data</Data1><Data2></Data2><Data3> < </Data3>But instead is displaying:
<Data1>Data</Data1><Data2></Data2><Data3> < </Data3>Any suggestions on my current regular expression are greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression to replace xml data
by Fletch (Bishop) on Oct 06, 2009 at 14:28 UTC | |
|
Re: Regular expression to replace xml data
by marto (Cardinal) on Oct 06, 2009 at 14:32 UTC | |
by dalegribble (Initiate) on Oct 06, 2009 at 15:01 UTC | |
by ELISHEVA (Prior) on Oct 06, 2009 at 15:20 UTC | |
|
Re: Regular expression to replace xml data
by Jenda (Abbot) on Oct 06, 2009 at 15:38 UTC | |
by ELISHEVA (Prior) on Oct 06, 2009 at 16:09 UTC | |
|
Re: Regular expression to replace xml data
by mirod (Canon) on Oct 06, 2009 at 19:59 UTC | |
|
Re: Regular expression to replace xml data
by grizzley (Chaplain) on Oct 07, 2009 at 08:19 UTC | |
by Anonymous Monk on Jul 26, 2013 at 01:48 UTC |