My requirement is that a password
string be validated in JavaScript:
(It should work for both firefox 3.0 and internet explorer 6 and IE7)
1. It must have ONE UPPERCASE.
2. It must have ONE LOWERCASE.
3. It must have ONE DIGIT.
4. SPECIAL CHARACTER is not mandatory.
I am using the regular expression:
var re = /(?=\w*[0-9])(?=\w*[a-z])(?=\w*[A-Z])\w*/;
Here the problem is that Abcd1@123 works.
However Abcd@123 does not work. I think the '@123' is being matched to \w*. Thus the condition of (?=\w*[0-9]) , that a digit is a mandatory is not being satisfied and my password match is failing. Anything after a special character is not being checked.
Can anyone help me please? Thanks in advance.
Kiran