Home >Backend Development >PHP Tutorial >javascript - Regular expression to find complete mobile phone number

javascript - Regular expression to find complete mobile phone number

WBOY
WBOYOriginal
2016-08-20 09:03:581185browse

大神们求完整的的手机号码正则表达式

回复内容:

大神们求完整的的手机号码正则表达式

^13[0-9]{9}|15012356789{8}|180256789{8}|147[0-9]{8}$

/^((13|8)|14[5|7]|15[0-3|5-9]|17[3|6-8])d{8}$/

<code>/^(13[0-9]|15[012356789]|17[0678]|18[0-9]|14[57])[0-9]{8}$/</code>

PHP:

<code>function checkphone($phone){
    if(preg_match("/1[3458]{1}\d{9}$/",$phone)){  
        return true;
    }else{
        return false;
    }
}</code>

/^(+?0?86-?)?1[345789]d{9}$/

var checkPhoneNumber = function(mobile){

<code>var reg= /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
return reg.test(mobile);</code>

}

好像和 @zealyw 的重复了。。。

<code class="js">var reg = /^(13[0-9]|15[0-35-9]|18[0-9]|17[06-8]|14[57])\d{8}$/</code>

https://gist.github.com/yuezk...

现在手机号已经不一定是1开头了

$reg="/^1(3[0-9]|4[57]|5[0-35-9]|8[0-9]|70)\d{8}$/";

<code>    $regForYD="/(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(^1705\\d{7}$)/";    //移动
    $regForLT="/(^1(3[0-2]|4[5]|5[56]|7[6]|8[56])\\d{8}$)|(^1709\\d{7}$)/";   //联通
    $regForDX="/(^1(33|53|77|8[019])\\d{8}$)|(^1700\\d{7}$)/";    //电信
    if (preg_match($reg, $phone)||preg_match($regForYD, $phone)||preg_match($regForLT, $phone)||preg_match($regForDX, $phone))
        return true;
    return false;</code>

<code>/^((\(\d{3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}$/</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn