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

3 Answers

Hard to say without more information on what you're trying to achieve.

That regular expression will match anything that does not have a whitespace at the end of the string.

this is a helpful tool https://regexr.com/

Stheven Cabral
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Stheven Cabral
Full Stack JavaScript Techdegree Graduate 29,854 Points

Sorry about that. I thought the question ties to the video I watched when I click the 'help' button. My question was tied to the 'Validating a Password' video in the 'Regular Expressions in JavaScript' course. Joel used the following lookaround: /^(?=.\d)(?=.[a-z])(?=.[A-Z]).$/

but was wondering if the follow could be used to validated a password (with lowercase, uppercase, and numbers only)? /[^\s]+$/

if not, what would be the best regex expression besides the lookaround Joel uses?

The problem with that solution is that it doesn't verify it has all of the required symbols.

It only checks if it DOESN'T have a space, but beyond that, anything goes.

I think a lookaround is pretty much the best way to do it, I wouldn't know of another efficient way to do that and to make sure it has all of the symbols you want it to have.