-
Notifications
You must be signed in to change notification settings - Fork 471
fix: reset regexg to prevent regexg with global flags to not match every element #1116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 714007e:
|
Codecov Report
@@ Coverage Diff @@
## main #1116 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 25
Lines 955 961 +6
Branches 311 312 +1
=========================================
+ Hits 955 961 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
84a0a22
to
687b1e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine but let's make sure we have a good follow-up strategy in case this doesn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice, thanks!
Blame me if somebody complains about noisy warnings added in a patch release 😄
@timdeschryver I think you need to push an empty commit or rebase and drop the merge commit. Codecov may not like merge commits which is a result of updating the branch from the GitHub UI. |
1840c48
to
9e7f25a
Compare
@eps1lon Done. |
🎉 This PR is included in version 8.11.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What: Resolves #1115
Why:
The instance of a regex that's using the global flag hold a
lastIndex
state.This might give false positive results.
For example:
How:
Added a reproduction test case.
Recreate a new regex instance from the original regex.
An alternative would be to reset the
lastIndex
to0
after the check.Checklist:
docs site