代码-JS之正则验证手机格式
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
var tel = '13888889999';
//var r = /^1\d{10}$/g; // 匹配11位纯数字,1开头
var r = /^1(32|33|34|35|86)\d{8}$/g; // 匹配2、3位
console.log(r.test(tel));
</script>
</body>
</html>
Copyright [2018] by [羊驼可以吃吗] form [https://www.cnblogs.com/phpisfirst/]