support the 'groupindex' attribute on compiled patterns#35
Open
srp wants to merge 1 commit intoaxiak:masterfrom
Open
support the 'groupindex' attribute on compiled patterns#35srp wants to merge 1 commit intoaxiak:masterfrom
srp wants to merge 1 commit intoaxiak:masterfrom
Conversation
The python 're' module has a 'groupindex' attribute on compiled
patterns. The re2 library also supports as much through
RE2::NamedCapturingGroups(), however prior to this patch it wasn't
exposed through pyre2.
For example:
>>> import re, re2
>>> re.compile("(?P<foo>aaa)(?P<bar>bbb)").groupindex
{'foo': 1, 'bar': 2}
>>> re2.compile("(?P<foo>aaa)(?P<bar>bbb)").groupindex
{'foo': 1, 'bar': 2}
Author
|
Am I suppose to include a new generation of re2.cpp as part of the pull request, or is that something you prefer to do? If I do it causes tons of lines to change due to my username vs yours, but I'm happy to include it if that's what you'd prefer. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The python 're' module has a 'groupindex' attribute on compiled
patterns. The re2 library also supports as much through
RE2::NamedCapturingGroups(), however prior to this patch it wasn't
exposed through pyre2.
For example:
This change is