1
我写了一个RegEx并试图匹配输入文本是否与它匹配。Javascript正则表达式匹配()在IE6中不起作用
var inputtxt = document.fd.pwd;
var decimal= /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,20}$/;
if(inputtxt.value.match(decimal))
{
alert("Your Password confirms to New Password Rules.");
}
else
{
alert("Your Password must contain atleast one each of following: \n\t 1 Uppercase alphabet \n\t 2 Lowercase alphabet \n\t 3 Digit[0-9] \n\t 4 Special Character[ie !,@,#,$ etc] \n\n It SHOULD NOT conatin any Blank spaces ");
}
此代码工作完全在FF /铬/ IE8 +但在IE6不工作。
让IE6死亡! – rekire
如果你想支持IE6,你最好不要在JavaScript中尝试任何奇妙的东西......你不能有一个服务器端验证后备? (无论如何你可能会需要这个) – rednaw
可能不支持lookahead。虽然不难解决。 – RobG