use strict;
my $str = '<script type="text/javascript">
var NVRAMyandex = \'Close\'; NVRAM_wan_static_dns_profile_yandex = (NVRAM_wan_static_dns_profile_yandex !=\'\') ? NVRAM_wan_static_dns_profile_yandex : \'basic\';
var FancyboxI18nClose = \'Close\';
var FancyboxI18nNext = \'Next\';
var FancyboxI18nPrev = \'Previous\';
var PS_CATALOG_MODE = false;
var ajaxsearch = true;
var attribute_anchor_separator = \'-\';
var blocksearch_type = \'top\';
var combinationsFromController = {"163972":{"attributes_values":{"15":"40"},"attributes":[75],"price":0,"specific_price":false,"ecotax":0,"weight":0.6,"quantity":1,"reference":"IDP20059--IDPA163972","unit_impact":0,"minimal_quantity":"1","date_formatted":"","available_date":"","id_image":-1,"list":"\'75\'"}};
var comparator_max_item = 0;
</script>';
my $regex = qr/var .* = '(.*?)';/mp;
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