rewrite regex in helpers.js to use `match` instead of `exec`

-- faster in firefox (according to jsperf tests), and more widely known