Hai Friends,
Am in need of Javascript to validate the password which must contain atleast one character,one number and one special character,please its urgent..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
brunda kPosted Jun 4, 2012, 6:13 AM
var PWD = ^.*(?=.*[a-zA-Z])(?=.*\d)(?=.*[!#$%&? "]).*$;
function valPsw(psw){
if (PWD.test(psw)) {
alert("VALID Password");
} else {
alert("INVALID Password");
}
}
http://www.learn-javascript-tutorial.com/RegularExpressions.cfm
VulpesPosted Jun 4, 2012, 6:12 AM
The following javascript regular expression will validate a password which contains:
1. At least one alphabetic character a-z or A-Z
2. At least one digit 0-9
3. At least one apostrophe, underscore or hyphen
var expr = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*['_-]).*$/