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 trialNaivedya Bansal
5,483 Points[^gov\t]
Not sure whether this is ignoring any of the characters g,o,v or all the characters . Also why is the \t so important here , if I remove it the output changes radically and it picks up a lot of unuseful data. also how do u ensure that these characers are ignore after the '.' symbol and not before it?
1 Answer
Unsubscribed User
3,273 PointsSo as it stands this regex [^gov\t] ignores anyone one of those the characters g, o, v, or a tab. Not being able to see all the code it is hard to remeber why \t is important in this case but I'm guessing it is because you are trying to skip along to the next word ignoring the tab in-between.
The \b defines a word boundary as a white space or non-word character (which could be at the beginning of the string or the end).
A great place to test out your regex, and get an explanation of why it works is regex101. I'm pretty enamored with it. You can even have it show you the python specific version of the code which is nice at times.
Naivedya Bansal
5,483 PointsNaivedya Bansal
5,483 Pointsalso another thing that is really confusing me is how is a word boundary identified? If we remove the \b in the beginning of the regex we created the string "@kennethlove" is also being picked up. I didn't get how this is working.