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 trialJordan James
1,929 PointsCan't tell what they're asking for here - seems like two different things but I could be wrong
Any help with this question is appreciated. Thanks.
import re
string = '''Love, Kenneth: 20
Chalkley, Andrew: 25
McFarland, Dave: 10
Kesten, Joy: 22
Stewart Pinchback, Pinckney Benton: 18'''
players = re.compile(r"(?P<last_name>\w+),\s(?P<first_name>\w+):?\s?(?P<score>\d*)?", re.M)
1 Answer
Stuart Wright
41,120 PointsThe format of your solution should look something like this:
players = re.match(r"your regex pattern in here", string, re.M)
Your version was using re.compile instead of re.match, and you didn't pass the string you want to search.
Once you change your solution to match the format posted above, you'll at least start getting some helpful error messages (your regex pattern isn't quite correct, but it's not far off). I pasted in your pattern as a starting point, then was able to solve it using the error messages to point me in the right direction, so I think it would be worth you trying the same. Let me know if you need any other hints.