Status: New
Owner: ----
New issue 1544 by mikesamuel: regular expression capturing group problem
http://code.google.com/p/v8/issues/detail?id=1544
On most JavaScript interpreters,
/^(?:\1x(y)x){2}$/.test("xyxyxyx")
is true because the \1 is a valid DecimalEscape, its value is 1, which is
not greater than NCapturingParens in 15.10.2.9 step 7 (NCapturingParens is
defined globally for the pattern, not just to the left of the current
escape). I.e., it is not a Syntax Error, so the \1 must be treated as a
back-reference.
The ^ anchors at start of input.
The first time through the {2} repetition, group 1 is blank, so the (?:...)
matches "xyx" from the input.
The second time through the {2} repetition, group 1 is "y" so the (?...)
matches "yxyx" from the input.
The whole input has been matched, so the $ assertion passes.
See http://es5.github.com/#x15.10.2.9 for more details.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev