Skip to content

Conversation

srp
Copy link

@srp srp commented Nov 25, 2015

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}

This change is Reviewable

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}
@srp
Copy link
Author

srp commented Nov 25, 2015

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!

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.

1 participant