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

JavaScript Regular Expressions in JavaScript Validating a Form Validating an Email

I think spaces are not allowed in email address!

I know we are not supposed to create a bullet-proof production-ready email validator regex in this basic course but obviously spaces are not allowed, so can't believe that the instructor came up with this [^@] for the first part of a valid email address. Quite strange. I'm not sure but maybe this particular segment needs to be reconsidered because according to his suggested regex something like these are valid! ')(@)(.com' , ' @ .com'

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Good point! And good for you for digging into the presentation to grasp a deeper understanding of code presented!

Looking at the RFC 5322 Official Standard for email regex (seen here), going into a full robust solution would be way passed the point of this introductory lesson: to expose the student to a basic application of regex. Email regex is a hard problem.

Keep up the good work!