For posterity, a short explanation of the regex would be good. Unless we can find a better way to do this w/o the regex. Regex especially in JavaScript is slow