Repair RegExp issue
see：http://stackoverflow.com/questions/1520800/why-regexp-with-global-flag-in-javascript-give-wrong-results