I've found that vanilla javascript doesnt support the /x verbose mode of regexes though there is an alternative XRegexp.