日期:2014-05-16 浏览次数:20419 次
<html>
<script type="text/javascript">
function verify()
{
var iphoneNum = "111411141";
var pattern = /(\d{0,30}(\d{3}[4]|\d{2}[4]\d|\d[4]\d{2}|[4]\d{3}))$/;
flag = pattern.exec(iphoneNum);
if(flag)
{
alert("4");
}
else
{
alert("!4");
}
}
</script>
<body>
<form >
<input type="button" onclick = 'verify();'>
</form>
</body>
</html>
var $a='342789';
var $b='279324';
var $r=/^\d*[1-35-9]{4}$/;
var $c =$r.test($a);