Updating Javascript Regex, Fixing one-char match

There was an issue where strings were not matching properly with escaped
strings in them, this is resolved with new Regex.
There was another issue where one-character tokens weren't getting the
closing span tag added and therefore were stripped from markup.