3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = <<<_ var Data = { 'a': 1, 'b': '{"a":[{"b":{"id":1}}]}' } var Data = { 'a': 2, 'b': '{"a":[{"b":{"id":2}}]}' }; // Some other text here that may have }; or }. Blahblah blah. // }; // } _; preg_match_all('~Data\s*=\s{(?:[^:}]*:.*\R+)+}~', $str, $matches); print_r($matches[0]);

preferences:
45.03 ms | 1974 KiB | 5 Q