I have the following string:

```
window['test'] = false; 
window['options'] = true; 
window['data'] = { "id" : 2345, "stuff": [{"id":704,"name":"test"};`

```

How would I go about extracting the JSON data in `window['data']`? The example data I provided is just a small sample of what really exists. There *could* be more data before and/or after `window['data']`.

I've tried this but had no luck:

```
preg_match( '#window["test"] = (.*?);\s*$#m', $html, $matches );

```