function CheckInput()
{
var s = document.getElementById("Text1").value;
var patrn=eval("/^['aaa']$/");
alert(patrn);
alert(s);
if (patrn.exec(s))
{
document.getElementById("Text2").value = document.getElementById("Text2").value + ",YES";
}
else
{
document.getElementById("Text2").value = document.getElementById("Text2").value + ",NO";
}
}
上面是我写的正则
当我在 Text1 中输入 a 时 Text2 中输出 YES
当我在 Text1 中输入 aa(或者更多字符) 时 Text2 中输出 NO请问怎么才能改为只有匹配 aaa 时 Text2 中输出 YES在线等
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货