Javascript Regex Infinite Loop On Some Patterns
I am trying to use the exec method on the JavaScript Regex object and can get into an infinite loop where exec does not return a null depending on the expression. Here is a test fu
Solution 1:
The pattern .*
matches the zero characters in the source string that come after the first match. It will keep on matching those zero characters forever. You could simplify a demonstration of that by matching against the empty string in the first place.
What you could do is quit when the match position stops changing.
Post a Comment for "Javascript Regex Infinite Loop On Some Patterns"