Hello All,
I'm using perl 5.8 and im having a problem with my regex.
the regex is supposed to return the data of a certain tag (between the opening and closing of the tag) in an XML file. Ex.
<page>
<title>Some Title</title>
<id>1149707</id>
<revision>
<id>4220</id>
<timestamp>2011-04-02T16:47:40Z</timestamp>
<contributor>
<username>some User Name</username>
<id>268</id>
</contributor>
<minor />
<text xml:space="preserve">some Text ...
.........
.....................
.....................
.....................</text>
</revision>
</page>
I tried to do a function that takes the text and the tag as an input and returns the data of that tag, but it returns nothing.
sub My_Regex
{
my($raw_text, $tag) = @_;
$raw_text =~ /<$tag>{1}(.*)(<\/$tag>){1}/;
$output = $1;
print "OUTPUT: $output\n";
}
Can someone help me with that!! knowing that, I dont use any XML parsers nor a higher version of perl