use strict;
my $str = '<a aria-label="фотография" onclick="return showPhoto(\'-100714248_457263531\', \'wall-100714248_195733\', {"temp":{"x":"https:\\/\\/sun1.tattelecom-nbc.userapi.com\\/AZsv8R78JOlrmsTJ6NR_NZpKj-RbfbWCPWQ8uA\\/QnMLGnxpnYk.jpg","y":"https:\\/\\/sun1.tattelecom-nbc.userapi.com\\/vtKcPNt6Wazn_vcPkvLAMX1MOhMz_hfRgYx28g\\/cXJNEGEn2Lc.jpg","z":"https:\\/\\/sun2.tattelecom-nbc.userapi.com\\/oZ0evVUqXklp4UGCisHHFRSaNTEfnnJO_A7lTg\\/ZqD22JRrSyw.jpg","x_":["https:\\/\\/sun1.tattelecom-nbc.userapi.com\\/AZsv8R78JOlrmsTJ6NR_NZpKj-RbfbWCPWQ8uA\\/QnMLGnxpnYk",359,604],"y_":["https:\\/\\/sun1.tattelecom-nbc.userapi.com\\/vtKcPNt6Wazn_vcPkvLAMX1MOhMz_hfRgYx28g\\/cXJNEGEn2Lc",480,807],"z_":["https:\\/\\/sun2.tattelecom-nbc.userapi.com\\/oZ0evVUqXklp4UGCisHHFRSaNTEfnnJO_A7lTg\\/ZqD22JRrSyw",587,987],"base":""},"queue":1}, event)" style="width: 68px; height: 115px;background-image: url(https://sun2.tattelecom-nbc.userapi.com/aMS3yYlzjZF3H6GPY1T5oDAeIqZD5uQv4WveMw/7ToUPNMTnmo.jpg);" class="page_post_thumb_wrap image_cover page_post_thumb_last_column fl_l page_post_thumb_not_single" data-photo-id="-100714248_457263531"></a>';
my $regex = qr/(?:https?|ftp):\\?\/\\?\/sun2.[^\s\,]+/ip;
if ( $str =~ /$regex/ ) {
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