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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![diginoma](https://secure.gravatar.com/avatar/b85e7d7e9d285982235a160fb4d40f78?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
diginoma
Courses Plus Student 8,009 PointsPlease help!
Create a variable named players that is an re.search() or re.match() to capture three groups: last_name, first_name, and score. It should include re.MULTILINE.
I get this error:
Bummer: error: nothing to repeat at position 73 (line 4, column 14)
import re
string = '''Love, Kenneth: 20
Chalkley, Andrew: 25
McFarland, Dave: 10
Kesten, Joy: 22
Stewart Pinchback, Pinckney Benton: 18'''
players = re.search(r'''
^(?P<first_name>[-\w]*),\s
(?P<last_name>[-\w]*)?:\s
(?P<score>?\d{2})$
''', string, re.X|re.M)
not sure what to do from here...
1 Answer
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsHey diginoma, Often the error message has all the info you need. The 73rd character of your regex is the ? following <score>. This means "one or none" of something. But there isn't anything between the field name and the ?. Hence the error. Remove this ?, and you're on your way....
The code will run but return a wrong value. Hint: are you capturing spaces that might be within the first or last names?
Your re
flags are correct.
- re.X is for verbose code making all whitespace explicitly encoded in the regex (regular whitespace is ignored).
- re.M is for multiline, in that, you wish to run the regex pattern on each line (up to the newline char) within the multi-line input string.
Post back if you need more help. Good luck!!