regex - Matching content between tags from RSS and inserting each match into an array - perl -


i'm not sure how else word want, i'll use examples have , want.

i have:

my $rss = ("<item><title>this test title</title></item> <item><title>this test title</title></item>"); @items = ($rss =~ /<item>[\s.*]<\/item>/g); 

and i'd end this:

@items[0]:    <title>this title</title> @items[1]:    <title>this title</title> 

i'd regex allow new lines when replace test string real rss still work. i'm sure there plenty i'm doing wrong, hours of searching has made me no closer want be.

the solution, provided lecturer:

my @items = ($rss =~ m{<item>(.*?)</item>}gs); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -