Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.