IE7正则表达式问题 - 在每个浏览器中工作的正则表达式在ie7中不起作用 [英] IE7 regex issue - Regex that work in every browser does not work in ie7

查看:329
本文介绍了IE7正则表达式问题 - 在每个浏览器中工作的正则表达式在ie7中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正则表达式验证密码值> 6< 25个字符,至少有一个数字。

I have a regex validating a password value to be > 6 < 25 characters with at least one number.

var passwordRegEx = /^(?=.*\d)(?=.*[a-zA-Z]).{6,25}$/;
if(!#quickRegister_Password').val().test(pass))
{
   errorMgs += 'Your password must be at least 6 characters and have at least 1 number and 1 letter.\r\n';
}

适用于Firefox,Chrome,IE8(IE7从IE8的兼容性运行)但不是IE7独立。

It works in Firefox, Chrome, IE8 (IE7 ran from compatability in IE8) but not IE7 standalone.

推荐答案

我认为你已经遇到了IE7的javascript引擎中的正则表达式先行错误。

I think you have run into the regular expression lookahead bug in IE7's javascript engine.

在此页面上运行测试,看看您的结果是否匹配;您可能会看到前瞻测试失败: http://www.javascriptjedi.com/regex/tests/

Run the tests on this page and see if your results match up; you will probably see the lookahead tests fail: http://www.javascriptjedi.com/regex/tests/

信息:

  • http://development.thatoneplace.net/2008/05/bug-discovered-in-internet-explorer-7.html
  • http://blog.stevenlevithan.com/archives/regex-lookahead-bug
  • http://forums.asp.net/p/1405215/3056174.aspx

这篇关于IE7正则表达式问题 - 在每个浏览器中工作的正则表达式在ie7中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆