I am 99% sure this would be much slower, regexes are JITed extremely efficiently in modern JS engines.