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

Python Regular Expressions in Python Introduction to Regular Expressions Groups

Why does the company contain \t at the end when \t is outside the group?

Kenneth Love In the video the when Kenneth is showing how to use groups, the company contains tab at the end Ex:teacher, Treehouse\t why is this so when the \t is outside the group.

2 Answers

Alexander Davison : I understand the reason for \t being outside the group, but my dilemma is that if you look at the pattern for the job "([-\w]+,\s[-\w\s]+)\t? " the \t is outside the group , however if you see the sample output below you will notice that jobs have a \t included in them(the same is observed in the video): "('Obama, Brack', 'president.44@us.gov','555 555-5551','President, United States of America\t','@potus44')"

If you observer the job in the tuple President, United States of America\t has a tab at the end even when the tab is outside the group. I noticed that if you use ([-\w]+,\s[-\w\s]+)?\t as pattern for the job too then the \t is not picked up when job pattern is selected .

The \t is outside the group because Kenneth doesn't want to have \ts included in the search results.

Basically the \t isn't part of the group.