Instead of all this regex, can you not do something like this:
`<h2 id="cc-main-title" data-template="Total GC Crashes for $PRODUCT $VERSION per 1M by Build ID">` and then simply to `var title = $('#cc-main-title').data('template').replace('$PRODUCT', product), ...`