Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDan Badertscher
5,327 Pointsmatch_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
Treehouse Moderator 68,457 PointsWhen 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
2,169 PointsSophia Zeng
2,169 PointsI tried to use match_object.group(email), but couldn't get it passed... Chris Freeman, did I get you wrong here??
Chris Freeman
Treehouse Moderator 68,457 PointsChris Freeman
Treehouse Moderator 68,457 PointsYou are close.
email
needs to be in quotes:match_object.group('email')