正则表达式验证手机号和座机号

资源来源于网络

联通现有号段是:130、131、132、155、156、186、185,其中3G专属号段是:186、185。还有无线上网卡专属号段:145。

移动现有号段是:134、135、136、137、138、139、150、151、152、157、158、159、182、183、184、188、187、178。

电信现有号段是:133、153、177、180、181、189、199。

 #region 正则表达式验证电话号码
        public static bool CheckMobliePhoneV2(string phone)
        {
            //电信手机号码正则        
            string dianxin = @"^1[35789][01379]\d{8}$";
            Regex dReg = new Regex(dianxin);
            //联通手机号正则        
            string liantong = @"^1[34578][01256]\d{8}$";
            Regex tReg = new Regex(liantong);
            //移动手机号正则        
            string yidong = @"^(134[012345678]\d{7}|1[34578][012356789]\d{8})$";
            Regex yReg = new Regex(yidong);

            if (dReg.IsMatch(phone) || tReg.IsMatch(phone) || yReg.IsMatch(phone))
            {
                return true;
            }
            return false;
        }

        /// <summary>
        /// 座机号格式校验
        /// </summary>
        /// <param name="telephone"></param>
        /// <returns></returns>
        public bool checkTelephone(string telephone)
        {
            string zuoji = @"^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$";  //比如:028-02866250077或0312-4295xxx的格式
            Regex gex = new Regex(zuoji);
            if (gex.IsMatch(telephone))
            {
                return true;
            }
            return false;
        }
        #endregion

 

转载于:https://www.cnblogs.com/likui-bookHouse/p/9131823.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值