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

Matched groups in (DEFINE) block do not appear when groupdict() is called #250

Closed
mrabarnett opened this issue Jul 11, 2017 · 2 comments
Closed
Labels
bug Something isn't working major

Comments

@mrabarnett
Copy link
Owner

Original report by Vilius Poška (Bitbucket: poskadesign, GitHub: poskadesign).


Hey,

I encounter some weird behaviour when running this code:

regex.match(r"""
(?(DEFINE)
    (?<w>\w+)
)
(?&w)
""", 'hey', regex.X | regex.V1)

The pattern matches but after calling groupdict() the match object returns {'w': None}. Is this the correct behaviour?

P.S. using Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] and regex 2016.6.23

@mrabarnett
Copy link
Owner Author

Original comment by Matthew Barnett (Bitbucket: mrabarnett, GitHub: mrabarnett).


It's more like a function definition than a capture group, so I'm going to leave it as-is.

@mrabarnett
Copy link
Owner Author

Original comment by Matthew Barnett (Bitbucket: mrabarnett, GitHub: mrabarnett).


Issue #252 was marked as a duplicate of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant