判断是否手机号码

//javascript
function isTelOrMobile(telephone) {
   var teleReg = /^((0\d{2,3})-)(\d{7,8})$/;
   var mobileReg = /^1[3456789]\d{9}$/;
   if (!teleReg.test(telephone) && !mobileReg.test(telephone)) {
      return false;
   } else {
      return true;
   }
}

//C#

public static bool IsMobilePhone(string input) {
   Regex regex = new Regex("^1\\d{10}$");
   return regex.IsMatch(input);
}

posted on 2016-12-20 15:17  lmx22  阅读(1647)  评论(0编辑  收藏  举报

导航