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

Add feature for disabling capturing groups #15

Closed
pemistahl opened this issue Feb 16, 2020 · 4 comments
Closed

Add feature for disabling capturing groups #15

pemistahl opened this issue Feb 16, 2020 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@pemistahl
Copy link
Owner

pemistahl commented Feb 16, 2020

grex produces regular expressions with capturing groups by default. Some users might prefer to create regexes with non-capturing groups instead, so I will add a new library method and a new command-line flag for handling this use case.

@pemistahl pemistahl added the enhancement New feature or request label Feb 16, 2020
@pemistahl pemistahl added this to the grex 1.1.0 milestone Feb 16, 2020
@waldyrious
Copy link

Could non-capturing groups be made the default, with the option working as opt-in rather than opt-out? The principle of least power applies here IMO.

@pemistahl
Copy link
Owner Author

I thought about making capturing groups the default because they produce less visual clutter than non-capturing groups. I will make a final decision about this later but your argumentation is definitely a valid one.

@pemistahl
Copy link
Owner Author

@waldyrious FYI: I've decided to make non-capturing groups the default and to enable capturing groups with an optional flag. I know that this will break backwards compatibility a little bit if someone relies already on capturing groups in their code. However, this is the more reasonable design and the principle of least power makes sense here as well. So this is it. Closed.

@waldyrious
Copy link

Great to hear! Thanks for the update.

pemistahl added a commit that referenced this issue Apr 7, 2020
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

2 participants