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.
In reply to Regular expression to replace xml data by dalegribble
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |