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

Fix named group mutations #1328

Merged
merged 2 commits into from
May 2, 2022
Merged

Fix named group mutations #1328

merged 2 commits into from
May 2, 2022

Conversation

dgollahon
Copy link
Collaborator

  • Regular expressions such as /(?<name>\w\d)/ would only end up mutating the part of the group (ex: /(?<name>\W\d)/ but not /(?<name>\w\D)/). This change fixes that error and mutates over all children of the named capture group.

@dgollahon dgollahon force-pushed the fix-named_group-mutations branch 2 times, most recently from 1601936 to f6ab614 Compare May 2, 2022 01:35
- Regular expressions such as `/(?<name>\w\d)/` would only end up mutating the part of the group (ex: `/(?<name>\W\d)/` but not `/(?<name>\w\D)/`). This change fixes that error and mutates over all children of the named capture group.
@dgollahon dgollahon requested a review from mbj May 2, 2022 01:51
@mbj mbj merged commit 464644c into main May 2, 2022
@mbj mbj deleted the fix-named_group-mutations branch May 2, 2022 02:16
dgollahon added a commit that referenced this pull request May 2, 2022
- Fix incomplete mutations for regexp capture groups. As an example, `/(\w\d)/` now gets mutated to `/(\W\d)/` and `/(\w\D)/` instead of just the former case.
- Likewise, fix capture group -> passive group mutations which would not get properly generated in many cases. As an example, `/(\w\d)/` woudl get mutated to `/(?\w)/` instead of `/(?:\w\d)/` like it will now.
- Closely related to #1328
dgollahon added a commit that referenced this pull request May 2, 2022
- Fix incomplete mutations for regexp capture groups. As an example, `/(\w\d)/` now gets mutated to `/(\W\d)/` and `/(\w\D)/` instead of just the former case.
- Likewise, fix capture group -> passive group mutations which would not get properly generated in many cases. As an example, `/(\w\d)/` woudl get mutated to `/(?\w)/` instead of `/(?:\w\d)/` like it will now.
- Closely related to #1328
dgollahon added a commit that referenced this pull request May 2, 2022
- Fix incomplete mutations for regexp capture groups. As an example, `/(\w\d)/` now gets mutated to `/(\W\d)/` and `/(\w\D)/` instead of just the former case.
- Likewise, fix capture group -> passive group mutations which would not get properly generated in many cases. As an example, `/(\w\d)/` would get mutated to `/(?\w)/` instead of `/(?:\w\d)/` like it will now.
- Closely related to #1328
dgollahon added a commit that referenced this pull request May 2, 2022
- Fix incomplete mutations for regexp capture groups. As an example, `/(\w\d)/` now gets mutated to `/(\W\d)/` and `/(\w\D)/` instead of just the former case.
- Likewise, fix capture group -> passive group mutations which would not get properly generated in many cases. As an example, `/(\w\d)/` would get mutated to `/(?:\w)/` instead of `/(?:\w\d)/` like it will now.
- Closely related to #1328
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants