$re = '/var\s?_u=\'(.*)\';var\s?_i=\'\d+\'/m';
$str = '<script nonce="0Riv3mh5Oi2oiInM7K0krg">(function(){var _u=\'https://encrypted-tbn0.gstatic.com/shopping?q\\x3dtbn:ANd9GcSnFEFIYwW9_wynoYlTURQHjGn5RoMtatIFKVxt1QBUCXK1PI34MGJNHwp6ejHXWpNMjmISleVQFeqe7Wu4O6tNKMjM3McKxGK8oR8YWr9XZN4gEHdWlWHVcw\\x26usqp\\x3dCAE\';var _i=\'2399509046500065955\';_setImagesSrc([_i],_u);})();</script>
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 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