How can I capture multiple matches from the same Perl regex?

As Jim’s answer, use the /g modifier (in list context or in a loop).

But beware of greediness, you dont want the .* to match more than necessary (and dont escape < = , they are not special).

while($string =~ /<img\s+src="https://stackoverflow.com/questions/2884549/(.*?)"/g ) {
  ...
} 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)