Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upQuestion: Intended semantics for setting lastIndex? #477
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
allenwb
Mar 15, 2016
Member
That's what ES3 and ES 5 did. See:
ES3 15.10.6.2 step 6 and ES5.1 15.10.6.2 step 9.a.i
|
That's what ES3 and ES 5 did. See: |
bterlson
added
the
question
label
Mar 18, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
Duping to #625. |
domenic
closed this
Jul 28, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
littledan commentedMar 15, 2016
In https://tc39.github.io/ecma262/#sec-regexpbuiltinexec step 12.a.iii,
lastIndexis set to 0 regardless of whether sticky or global is true. However, in all other cases,lastIndexis only set when those flags are present. These semantics were a little surprising to me--were they intentional? I'm curious about the history. This came up for me in code review for implementing part of ES2017 semantics for RegExps https://codereview.chromium.org/1776883005 @allenwb @hashseed