javaScript手機號碼校正工具類PhoneUtils詳解

來源:互聯網
上載者:User

標籤:工具   test   china   www.   訊號   聯通   lan   regex   phone   

本文執行個體為大家分享了javaScript手機號碼校正工具類PhoneUtils的具體代碼,供大家參考,具體內容如下

//PhoneUtils命名空間 PhoneUtils = {  phoneRegexs: {   //中國電訊號碼段      CHINA_TELECOM_PATTERN: /^(?:\+86)?1(?:33|53|7[37]|8[019])\d{8}$|^(?:\+86)?1700\d{7}$/,   //中國聯通號碼段   CHINA_UNICOM_PATTERN: /^(?:\+86)?1(?:3[0-2]|4[5]|5[56]|7[56]|8[56])\d{8}$|^(?:\+86)?170[7-9]\d{7}$/,   //中國移動號碼段   CHINA_MOBILE_PATTERN: /^(?:\+86)?1(?:3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\d{8}$|^(?:\+86)?1705\d{7}$/,   //電話有線電話號碼段   PHONE_CALL_PATTERN: /^(?:\d3,4|\d{3,4}-)?\d{7,8}(?:-\d{1,4})?$/,   //手機號碼   PHONE_PATTERN: /^(?:\+86)?(?:13\d|14[57]|15[0-35-9]|17[35-8]|18\d)\d{8}$|^(?:\+86)?170[057-9]\d{7}$/,   //手機號簡單校正,不根據電訊廠商分類   PHONE_SIMPLE_PATTERN: /^(?:\+86)?1\d{10}$/  },  //電話號碼  isPhoneCallNum: function(input) {   return this.phoneRegexs.PHONE_CALL_PATTERN.test(input);  },  //電信手機號碼  isChinaTelecomPhoneNum: function(input) {   return this.phoneRegexs.CHINA_TELECOM_PATTERN.test(input);  },  //中國聯通  isChinaUnicomPhoneNum: function(input) {   return this.phoneRegexs.CHINA_UNICOM_PATTERN.test(input);  },  //中國移動  isChinaMobilePhoneNum: function(input) {   return this.phoneRegexs.CHINA_MOBILE_PATTERN.test(input);  },  //手機號碼  isPhoneNum: function(input) {   return this.phoneRegexs.PHONE_PATTERN.test(input);  },  //手機號碼簡單校正,只校正長度  isPhoneNumBySize: function(input) {   return this.phoneRegexs.PHONE_SIMPLE_PATTERN.test(input);  } }; 

 在 http://www.cnblogs.com/yoyonow/ 有關於Python的更多介紹、

javaScript手機號碼校正工具類PhoneUtils詳解

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.