Click here to Skip to main content
16,021,757 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
JavaScript
function janrainPasswordValidation(name, value, validation) {
validation.pending();
var regex = /^.*(?=.*\d)(?=.*[a-zA-Z]).*|.*(?=.*\d)(?=.*[`~!@#$%^&*]).*|.*(?=.*[`~!@#$%^&*])(?=.*[a-zA-Z]).*$/
if (regex.test(value)) {
validation.valid();
return true;
} else {
validation.notValid();
return false;
}
}
Posted
Updated 4-Aug-15 21:13pm
v2
Comments
Mohibur Rashid 5-Aug-15 3:15am    
This function works fine.
Kornfeld Eliyahu Peter 5-Aug-15 3:23am    
How you call this function?
sasanka sekhar panda 5-Aug-15 3:49am    
Are you calling this function on onblur function of the password textbox
W Balboos, GHB 5-Aug-15 7:25am    
As an aside, for some types of input items, and passwords in particular, it's often a good practice to trim away leading and trailing whitespace before you check the text.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900