downer has asked for the wisdom of the Perl Monks concerning the following question:
here is an example of the data to be parsed:my $name = ''; if($x =~ /<name>(.*?)<\/name>/igs) { $name = $1; } my $time = ''; if($x =~ /<published>(.*?)<\/published>/igs) { $time = $1; } my $content = ''; if($x =~ /<content type='text'>(.*?)<\/content +>/igs) { $content = $1; $content =~ s/\n/ /ig; } print "$id\t$name\t$time\t$content\n";
for some reason, my regular expressions aren't matching any field except for content. any idea what the problem is?<id>http://gdata.youtube.com/feeds/api/videos/5InqyMvRZ8o/comments/730 +7D6E7F6E2D1B8 </id> <published>2007-04-05T12:05:42.000-07:00 </published> <updated>2007-04-05T12:05:42.000-07:00 </updated> <category scheme='http://schemas.google.com/g/2005#kind' term='http:// +gdata.youtube.com/schemas/2007#comment'/> <title type='text'>Fantastisk video,, ... </title> Keep up the good work. - jeg glæder mig meget til at se flere video +er fra dig..uper billeder du har fundet (: </content> <link rel='related' type='application/atom+xml' href='http://gdata.you +tube.com/feeds/api/videos/5InqyMvRZ8o'/> <link rel='alternate' type='text/html' href='http://www.youtube.com/wa +tch?v=5InqyMvRZ8o'/> <link rel='self' type='application/atom+xml' href='http://gdata.youtub +e.com/feeds/api/videos/5InqyMvRZ8o/comments/7307D6E7F6E2D1B8'/> <author> <name>cajaneil </name> <uri>http://gdata.youtube.com/feeds/api/users/cajaneil </uri> </author>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: trouble with regular expressions, dont know why patters aren't matching
by GrandFather (Saint) on Mar 31, 2008 at 23:14 UTC | |
|
Re: trouble with regular expressions, dont know why patters aren't matching
by jettero (Monsignor) on Mar 31, 2008 at 22:52 UTC | |
|
Re: trouble with regular expressions, dont know why patters aren't matching
by ikegami (Patriarch) on Mar 31, 2008 at 23:00 UTC | |
|
Re: trouble with regular expressions, dont know why patters aren't matching
by BrowserUk (Patriarch) on Mar 31, 2008 at 23:07 UTC | |
by downer (Monk) on Apr 01, 2008 at 00:41 UTC |