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 trialAnish Shah
528 PointsRegex for phone numbers not working!
Hello,
I am getting "Bummer: Didn't get the right number of phone numbers" for the attached code! Assignment asked for writing a function to get all phone numbers from input in 555-555-5555 format.
Thank you!
import re
def phone_numbers(data):
return re.findall(r'\d{3}-\d{3}-d{4}', data)
1 Answer
Ryan Groom
18,674 PointsHello Anish Shah you were very close, but if you look closely you'll realize that you are missing a "\" before your final set of 4 digit values. So your solution will be this:
import re
def phone_numbers(data):
return re.findall(r'\d{3}-\d{3}-\d{4}', data)
Anish Shah
528 PointsAnish Shah
528 PointsThank you Ryan!