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

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

java - SmsManager sending message more than one -