Change Password Control RegEx validating oddly in IE 7 only

前端 未结 1 1035
南方客
南方客 2020-12-07 04:34

I\'m using the Asp.net change password control in my application and all seems to be find and dandy until a user tells me she has a problem meeting the strength requirements

相关标签:
1条回答
  • 2020-12-07 05:20

    Apparently Internet Explorer has a bug. Check out this post: A JScript/VBScript Regex Lookahead Bug. The example is the same - a password check - and they provide a work-around. Using their suggested approach as a guide, the pattern becomes:

    ^(?=.{5,15}$)(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*
    

    Their pattern is very similar to yours, except for the negative look-around for whitespace.


    Try using .* in the look-arounds. Using just . only covers one character followed by whatever you're specifying in the look-arounds. You want to look all the way ahead and see if anything matches. I tried the following expression in Expresso and it worked with the samples you listed and also failed on invalid inputs as expected.

    ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).{5,15}$
    
    0 讨论(0)
提交回复
热议问题