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 haskey(::RegexMatch, ::Symbol) to test for named capture groups #36717

Merged
merged 3 commits into from
Aug 4, 2020

Conversation

staticfloat
Copy link
Sponsor Member

Currently, the only way to test for a named capture group within
RegexMatch is to attempt to index into it and catch the error after it
fails; this adds a way to probe for a given key.

Currently, the only way to test for a named capture group within
`RegexMatch` is to attempt to index into it and catch the error after it
fails; this adds a way to probe for a given key.
This error path is more helpfully handled by all call sites.
@staticfloat
Copy link
Sponsor Member Author

@StefanKarpinski I reverted one of your return code checks because I didn't want to rely on exceptions in order to figure out if a named capture group does or does not exist. I hope that's okay; I checked that all call sites are properly dealing with that error code already.

@StefanKarpinski
Copy link
Sponsor Member

Sure, that's probably a good change.

@staticfloat staticfloat merged commit c342ef8 into master Aug 4, 2020
@staticfloat staticfloat deleted the sf/regexmatch_haskey branch August 4, 2020 22:16
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.

3 participants