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 trialBenjamin Guyton
6,858 Pointsbad character range??
I'm receiving an error message of bad character range in line 3, which would be the strings in string provided by the problem. I have not seen this error before and am not too sure what it means. I feel like my code for contacts is correct, would love some feedback here please.
import re
string = '''Love, Kenneth, kenneth+challenge@teamtreehouse.com, 555-555-5555, @kennethlove
Chalkley, Andrew, andrew@teamtreehouse.co.uk, 555-555-5556, @chalkers
McFarland, Dave, dave.mcfarland@teamtreehouse.com, 555-555-5557, @davemcfarland
Kesten, Joy, joy@teamtreehouse.com, 555-555-5558, @joykesten'''
contacts = re.search(r'''
(?P<email>[\w+.]+@[\w.]+),\s
(?P<phone>[\d{3}-\d{3}-\d{4}),\s
''', string, re.I|re.X)
ygh5254e69hy5h545uj56592yh5j94595682hy95
7,934 Pointsygh5254e69hy5h545uj56592yh5j94595682hy95
7,934 PointsYour code:
Code that I researched and worked:
I don't know much about python because I'm currently working on C#, but I'm just trying to help! Good luck,
Also, you got the bad character range error because you forgot to put ] here -->
(?P<phone>[\d{3}*right here*-\d{3}-\d{4}),\s