You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
We should probably still expose lastIndex from iterator object itself (as in opposite to old regexp-bound property). This can be useful for some cases like regexp with sticky flag, where we want to know whether our "tokenization" matched entire string or stopped somewhere in the middle as following text didn't match so that we could handle error / try another regexp / whatever.
Otherwise, /^regexp/y for regexpregexpregexp something something regexp and regexpregexpregexp returns same list of matches and it becomes impossible to figure out whether and where the error occured.
The text was updated successfully, but these errors were encountered:
I think exposing it makes sense; how would you suggest exposing lastIndex?
Here are some options that come to mind:
set an additional lastIndex property on the match object (normal match objects coming from exec only have input and index, and likely groups after named capture groups land).
Hmm I'm now trying to remember whether I simply misunderstood the original proposal (that it returns not just strings but also index) or had something else in mind. If we have index + match.length, it's probably sufficient to figure out if you matched entire string or not.
We should probably still expose
lastIndex
from iterator object itself (as in opposite to old regexp-bound property). This can be useful for some cases like regexp with sticky flag, where we want to know whether our "tokenization" matched entire string or stopped somewhere in the middle as following text didn't match so that we could handle error / try another regexp / whatever.Otherwise,
/^regexp/y
forregexpregexpregexp something something regexp
andregexpregexpregexp
returns same list of matches and it becomes impossible to figure out whether and where the error occured.The text was updated successfully, but these errors were encountered: