JS 正则表达式注意事项 RegExp 有 lastIndex 记录最后一次成功匹配的位置。 下一条语句是从 lastIndex 开始的 参考:http://stackoverflow.com/questions/1520800/why-regexp-with-global-flag-in-javascript-give-wrong-results