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 trialAlex Rendon
7,498 PointsWhere is my error in this regular expression?
I have to match all the numbers in the string, except "567". I except the three numbers with this "^", but I have an error and I don't know what I have to do. Thanks.
import re
string = '1234567890'
good_numbers = re.findall(r'\w+[^567]', string)
1 Answer
Bryan Manhollan
Courses Plus Student 10,096 Points\w+ is not needed. \w looks for a word character.
Alex Rendon
7,498 PointsAlex Rendon
7,498 PointsThe error still appears, Now the output is: "12347890" That excluded only the numbers "56", but the "7" appears. Why?
Bryan Manhollan
Courses Plus Student 10,096 PointsBryan Manhollan
Courses Plus Student 10,096 PointsThis passes for me.
Alex Rendon
7,498 PointsAlex Rendon
7,498 PointsOh, thanks jajaja. That error... :P