actions-ecosystem / action-regex-match

🔍 GitHub Action to do regex matching
https://github.com/marketplace/actions/actions-ecosystem-action-regex-match
Apache License 2.0
107 stars 36 forks source link

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

Open kaisugi opened 2 years ago

kaisugi commented 2 years ago

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.