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 trialVictor Stanciu
Full Stack JavaScript Techdegree Student 11,196 PointsWhy did we use "\s" and not just a simple " " (just a space)?
Shouldn't we use just a space " " instead of whitespace? I tried the regex with whitespace on regex101.com and it also matches the telephone number if I press enter instead of space (meaning writing the telephone number on two lines).
I know this case might be basically impossible in a form, but still I think a space is better.
1 Answer
Jason Larson
8,361 PointsHonestly, I don't think there's a good reason for using the \s
in this regex. In fact, the instructor states that he's putting in a space when he puts in the \s, so I agree with you that a simple space is appropriate here.