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
Daniel Petrov3,495 Points
Is there a difference between space and \s?
Is there a difference between using space and \s in the sets and outside? In the name we use [-\w ] and in job we use [-\w\s]. Can we use just space when specifying the space between the words or only \s?
Steven Parker228,978 Points
A space just matches a space. The
\s code matches any kind of "white space", including space, tab, vertical tab, return, new line, and form feed.
Alx KiPython Web Development Techdegree Graduate 14,822 Points
Daniel Petrov, yes, \s should match almost any kind of whitespace, even letterspaces, tabs, halftabs, newlines etc. Negation 6:00 And, i guess, if you add + it will match 1x and 2x space and more: \s+