$re = '/<script>.*(adsConfig).*<\/script>/sm';
$str = '<script>
var middleCount = 0;
var = {
nonLinear: {
url: "https://8245.digital/vpaid/?id=7875&type=nonlinear&dcc=1",
total: 0 ,
offset: 10 * 60,
label: { name: \'label\', val: \'overlay\', counter: true }
},
pre: {
maxImpressions: 2 ,
urls: ["https://8245.digital/vpaid/?id=5241&label=preroll&dcc=1&maximp=2&synconly=1"]
},
middle: {
pop: true,
maxTotalImp: 0 ,
maxImpressions: 1,
urls: ["https://8245.digital/vpaid/?id=21515&synconly=1&maximp=1&dcc=1&mid=6","https://8245.digital/vpaid/?id=5242&synconly=1&maximp=1&dcc=1&mid=6"]
,
getUrls: function () {
var u = middleCount && .middle.urls
? .middle.urls.slice(1)
: .middle.urls;
middleCount++;
return u;
},
label: { name: \'label\', val: \'middleroll\', counter: true }
},
confirmTimeout: 60 * 1000,
confirmOn: [\'localhost\', \'zombie-film.net\'],
vast: {timeouts: {loading: 20000, starting: 20000, global: 120000}},
volume: 0.3,
tv: true,
suppressOnFakeFullScreen: true
};
</script>';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php