Reputation: 19
I am trying to validate a password in Javascript and require that it has a letter (upper or lowercase), a number, and a symbol. This is the Regex I have
/(?=.*\d)(?=.*[a-zA-Z])(?=.*\W)/
This does not seem to be working. Any suggestions?
Upvotes: 0
Views: 249
Reputation: 46
You are missing a couple of asterisks.
/(?=.*\d)(?=.*[a-zA-Z])(?=.*\W)/
edit: The question was edited. The code now works as is.
Upvotes: 3