Skip to content
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

use .matchAll() instead of .exec() #273

Open
kaisugi opened this issue Feb 5, 2022 · 0 comments
Open

use .matchAll() instead of .exec() #273

kaisugi opened this issue Feb 5, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@kaisugi
Copy link
Contributor

kaisugi commented Feb 5, 2022

What you want to add

I would suggest to use String.prototype.matchAll(), which provides multiple matching at the same time.

The results of the second and subsequent matches will look like match2, match3, ..., match9, and each group will be prepared in the form of match2-group1, ..., match2-group9.

Why this is needed

As already mentioned in #230, we cannot access to the value that matches the regex in the second or later positions.
This is due to the fact that RegExp.prototype.exec() captures patterns one by one.

This causes some problem where we want to list multiple patterns in GitHub Issue titles.

@kaisugi kaisugi added the enhancement New feature or request label Feb 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant