Change Password Control RegEx validating oddly in IE 7 only

纵饮孤独 提交于 2019-11-28 02:14:25

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}$
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!