Reputation: 322
I've a pretty good password validation, but I would like to add some more functionality.
You can see an example here http://jsfiddle.net/yfM5T/22/
Currently I've a password that checks, 7 chars, 1 upper case, 1 digit and 1 special character and even it won't allow white space.
But I want to add
Pass@123456789
but Pass123456@789
is ok)saaga
is ok but saaaga
is not allowed)Bonus if the password validation tool tip shows the white space validation message only if the user put a white space rather than showing onfocus (only for the white space, 9 consequtive numbers, username etc.)
Upvotes: 1
Views: 1543
Reputation: 26920
^(?!.*\d{9}.*)
^(?!.*([a-zA-Z])\1\1)
For the second rule just use a string comparison with the username.
Upvotes: 2