Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Regular Expressions in Python Introduction to Regular Expressions Review: Regular Expressions in Python

Dan Badertscher
Dan Badertscher
5,327 Points

match_object.____ (Regular Expressions Quiz)

I've watched the video for this question a few times and i'm still not getting it. Can someone point me in the right direction?

Fill in the blank below:

How would I get the contents of the group named email from my match object?

match_object.__________

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,989 Points

When named groups are matched in a regex, each result can be referred to by name (See match.group(), if m is your match object, using m.group(name_of_the group). In your case the group name would be 'email'

Sophia Zeng
Sophia Zeng
2,169 Points

I tried to use match_object.group(email), but couldn't get it passed... Chris Freeman, did I get you wrong here??

Chris Freeman
Chris Freeman
Treehouse Moderator 67,989 Points

You are close. email needs to be in quotes:

match_object.group('email')