javascript - How to validate password using following conditions? -
password should contain
at to the lowest degree 1 uppercase letter at to the lowest degree 1 lowercase letter at to the lowest degree 1 digit at to the lowest degree 1 special symbol should more 4 characteri have tried - ^(?=.*\d)(?=.*[a-za-z])[a-za-z0-9!@#$%&*]{6,20}$
you don't need big monster single regular expression, involve arcana such lookaheads, , hard maintain new conditions added. need is
function validatepassword(pw) { homecoming /[a-z]/ .test(pw) && /[a-z]/ .test(pw) && /[0-9]/ .test(pw) && /[^a-za-z0-9]/.test(pw) && pw.length > 4; }
javascript
No comments:
Post a Comment