re = /var .* = '(.*?)';/m
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>'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html