diff --git a/packages/jsparse/lexer.js b/packages/jsparse/lexer.js index c62e2c6bd4..95cef2d179 100644 --- a/packages/jsparse/lexer.js +++ b/packages/jsparse/lexer.js @@ -325,7 +325,9 @@ JSLexer.prototype.next = function () { if (match && (match.index !== pos)) match = null; // Record the end position of the match back into `pos`. - if (match) + // Avoid an IE7 bug where lastIndex is incremented when + // the match has 0 length. + if (match && match[0].length !== 0) pos = regex.lastIndex; return match; };