The following regular expression works in chrome and firefox, but not IE7:
^((?=.*\\d)(?=.*[az])(?=.*[AZ]).{8,20})$
It needs to contain at least 8 characters and have at least on uppercase and a number. When I try this in IE7, I have to type 14 characters for it to validate. Can someone explain why and what would be the correct expression for all 3 browsers.
I am using an asp:RegularExpressionValidator to validate the password.
been asked before:
str.length > 8
/[A-Z]/
/\d/
Three checks vs. one monster regex. Which is easier to read and doesn't cause issues in IE?
if( str.length > 8 && str.search(/[A-Z]/) != -1 && str.search(/\d/) != -1 )
{
//Don't use big long regex when you don't need it
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.