Tag Info

New answers tagged

0

With the caveat that behaviour may vary by regex engine (which are you using?), one thought: (\S+\s*)+ (the first half) also matches strings matched by (==|>=|<=|>|<)\s* (the second half). Matching is greedy by default, so the first half will swallow the operator, then the second half will fail, then backtracking will begin. If you can use ...


2

match is just a wrapper for exec, per ES5 15.5.4.10, step 8(f)(i): Let result be the result of calling the [[Call]] internal method of exec with rx as the this value and argument list containing S. For a global regex, match continuously calls exec until exec retruns a null value. When we look at exec, we see that each call to exec with a global regex ...



Top 50 recent answers are included