js 手機號碼驗證


function IsPhoneAvailable (numStr) {

    var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
    return myreg.test(numStr);
}

  

C#驗證方法:

public static bool IsMobilePhone(string numStr)
{
    Regex regex = new Regex("^1[34578]\\d{9}$");
    return regex.IsMatch(numStr);
}

  

參考:https://www.cnblogs.com/wuhuisheng/archive/2011/03/23/1992652.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM