ŞuRvīvőr has asked for the wisdom of the Perl Monks concerning the following question:
<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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with Regex
by moritz (Cardinal) on Aug 01, 2011 at 10:24 UTC | |
by ŞuRvīvőr (Novice) on Aug 01, 2011 at 13:09 UTC | |
by ŞuRvīvőr (Novice) on Aug 01, 2011 at 13:11 UTC | |
by moritz (Cardinal) on Aug 01, 2011 at 13:32 UTC | |
|
Re: Problem with Regex
by JavaFan (Canon) on Aug 01, 2011 at 09:59 UTC | |
by ŞuRvīvőr (Novice) on Aug 01, 2011 at 10:11 UTC | |
by jethro (Monsignor) on Aug 01, 2011 at 10:30 UTC | |
by JavaFan (Canon) on Aug 01, 2011 at 10:24 UTC | |
by ŞuRvīvőr (Novice) on Aug 01, 2011 at 10:03 UTC | |
|
Re: Problem with Regex
by jwkrahn (Abbot) on Aug 01, 2011 at 10:20 UTC | |
|
Re: Problem with Regex
by Logicus (Initiate) on Aug 02, 2011 at 13:07 UTC | |
|
Re: Problem with Regex
by delirium (Chaplain) on Aug 02, 2011 at 16:31 UTC | |
|
Re: Problem with Regex
by juampatronics (Initiate) on Aug 02, 2011 at 09:52 UTC |