I have some HTML that looks like this:

```
    $(document).ready(function(){
        $('#cumulative-returns').graph({
            width: 400,
            height: 180,
            type: 'bar',
            x_label: 'Month',
            x_data: ['Jan','Feb','Mar','Apr'],
            y_label: 'Cumulative Return',
            y_data: ['5','10','15','20'],
            colors: ['666666', '000000', 'ff0000', '333366']
        });

        $('#new-returns').graph({
            width: 400,
            height: 180,
            type: 'bar',
            x_label: 'Month',
            x_data: ['Jan','Feb','Mar','Apr'],
            y_label: 'Cumulative Return',
            y_data: ['5','10','15','20'],
            colors: ['666666', '000000', 'ff0000', '333366']
        });
    });

```

What I need to do is replace `x_data` and `y_data` with new values using some nifty regex in PHP.

This is what I have come up with so far just to find the right graph but even that doesn't work.

```
$graph = "cumulative-returns";
$start_tag = '$(\'#'.$graph.'\').graph({';
$end_tag = '});';
preg_match_all("/".preg_quote($start_tag)."(.+?)".preg_quote($end_tag)."/i", $html, $matches);
print_r($matches);

```

Any suggestions would be great!

\*edit:

**Please ignore the fact that its javascript, I just need to some regex to find the string between `$('#cumulative-returns').graph({` and `});` characters!**