Perl Regex Multiple Items in Single String
Posted
by Sho Minamimoto
on Stack Overflow
See other posts from Stack Overflow
or by Sho Minamimoto
Published on 2010-05-21T18:25:12Z
Indexed on
2010/05/21
18:40 UTC
Read the original article
Hit count: 320
I'm trying to parse a single string and get multiple chunks of data out from the same string with the same regex conditions. I'm parsing a single HTML doc that is static (For an undisclosed reason, I can't use an HTML parser to do the job.) I have an expression that looks like
$string =~ /\<img\ssrc\="(.*)"/;
and I want to get the value of $1. However, in the one string, there are many img tags like this, so I need something like an array returned (@1?) is this possible?
© Stack Overflow or respective owner