^(?=[\w\-%&?
Designed to meet the following conditions in verifying a new password based on JavaScript,
- Must contain at least 8-20 characters, including one letter and number
- It can include only one of the following special characters:%, &, _,?, #, =, -
- There can be no spaces
With the above expression goog123#was compared in FF3.5. However, this fails in IE6. Does anyone know what's wrong here? Is this a compatibility issue?
JavaScript used to verify compliance
function fnIsPassword(strInput)
{
alert("strInput : " + strInput);
var regExp =/^(?=.{0,19}\d)(?=.{0,19}[a-zA-Z])[\w%&?#=-]{8,20}$/;
if(strInput.length > 0){
return (regExp.test(strInput));
}
return false;
}
alert(fnIsPassword("1231231")); //false
alert(fnIsPassword("sdfa4gggggg")); //FF: true, false in IE
alert(fnIsPassword("goog1234#")); //FF: true , false in IE
source
share