Pattern Matching with Regular Expressions in perl
Hi
i have doubts in Pattern Matching with Regular Expressions in perl,
input:
sample.xml
----------
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="">
<front>
<publisher>
<publisher-name>Public Library of Science</publisher-name>
</publisher>
</article>
perl coding:
-----------
if ($line=~m/<publisher>\s*<publisher-name>(.*)<\/publisher-name>/gi)
{
$colno = pos ($line);
push @errors, "[$lineno:$colno]\t--publisher name: \"$1\" \n";
}
output:
--------
Sample.xml
Below are the 0 Notification(s) Found:-
--------------------------------------
My expecting output
------------------
Sample.xml
Below are the 1 Notification(s) Found:-
--------------------------------------
[3:69] --publisher name: "Public Library of Science"
Pls reply
Thanks in Advance
Sankar B
|