use strict;
my $str = '<img src="http://ia.media-imdb.com/images/M/MV5BMTY3NjY0MTQ0Nl5BMl5BanBnXkFtZTcwMzQ2MTc0Mw@@._V1_SY317_CR0,0,214,317_AL_.jpg" />
<img src="http://ia.media-imdb.com/images/M/MV5BMjAzODk4OTI3Ml5BMl5BanBnXkFtZTgwMzU2MTY0MzE@._V1_SX86_CR0,0,86,86_AL_.jpg" />
<img src="http://ia.media-imdb.com/images/M/MV5BNzUzNzY1NzQxM15BMl5BanBnXkFtZTgwMTM0MTY0MzE@._V1_SY86_CR33,0,86,86_AL_.jpg" />
<img src="http://ia.media-imdb.com/images/M/MV5BMTAxNTAwMTg0ODReQTJeQWpwZ15BbWU4MDMzNDE2NDMx._V1_SY86_CR33,0,86,86_AL_.jpg" />';
my $regex = qr/^((?!\bsrc\b).)*src="([^"]+)/p;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html