search
Homephp教程PHP源码多种移动手机号码正则表达式验证代码

<script>ec(2);</script>

手机(中国移动手机号码):regexp="^(((d{3}))|(d{3}-))?13[456789]d{8}|15[89]d{8}"

所有手机号码:regexp="^(((d{3}))|(d{3}-))?13[0-9]d{8}|15[89]d{8}"(新添加了158,159两个号段)


本文介绍一下验证手机号码的正则表达式,包含最新186,188号码哦,如下:

验证是否为手机号码的正则:"^(13[0-9]|15[0|3|6|7|8|9]|18[6|8|9])d{8}$"

验证是否为移动手机号码的正则:"^1(3[4-9]|5[012789]|8[78])d{8}$"


使用正则表达式匹配手机号码--java源代码

手机号验证的正则为:

var reg =/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/;

var reg =/^0{0,1}(13[0-9]|15[0-9])[0-9]{8}$/;
移动手机号的验证正则为:

var reg =/^0{0,1}(13[4-9]|15[7-9]|15[0-2]|18[7-8])[0-9]{8}$/;
2009.11.23 新增加移动151,152号段,但是没有在源码教程演示中放出,下面代码已经更新

看个实例

 function CheckChinaMobileID(mobile){
       
        if (mobile==""){
            alert("请填写手机号码!");
            return false;
        }
        if(isNaN(mobile)||(mobile.length!=11)){
            alert("手机号码为11位数字!请正确填写!");
            return false;
        }
        var reg =/^0{0,1}(13[4-9]|15[7-9]|15[0-2]|18[7-8])[0-9]{8}$/;
        if(!reg.test(mobile))
        {
            alert("您的手机号码不是移动号码,请重新输入");
           
            return false;
        }
        alert("大爷,这个真是移动的手机号");
        return true;
    }
    function CheckIsMobile(mobile){
       
        if (mobile==""){
            alert("请填写手机号码!");
            return false;
        }
        if(isNaN(mobile)||(mobile.length!=11)){
            alert("手机号码为11位数字!请正确填写!");
            return false;
        }
       
        var reg =/^0{0,1}(13[0-9]|15[0-9])[0-9]{8}$/;
        if(!reg.test(mobile))
        {
            alert("您的手机号码不正确,请重新输入");
           
            return false;
        }
        alert("大爷,这个真是手机号,是哪的我不知道");
        return true;
    }
 
手机号验证正则表达式
手机号验证的正则为: var reg =/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/; var reg =/^0{0,1}(13[0-9]|15[0-9])[0-9]{8}$/; 移动手机号的验证正则为: var reg =/^0{0,1}(13[4-9]|15[7-9]|15[0-2]|18[7-8])[0-9]{8}$/; 手机号验证正则表达式昨天找了好久,终于在一个站上把这个手机号验证的正则表达式给扒下来了,手机号验证的正则为: var reg =/^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/; var reg =/^0{0,1}(13[0-9]|15[0-9])[0-9]{8}$/; 移动手机号的验证正则为: var reg =/^0{0,1}(13[4-9]|15[7-9]|15[0-2]|18[7-8])[0-9]{8}$/; 新增加移动151,152号段,但是没有在源码演示中放出,下面代码已经更新这可是包括15x话段的哈

再来个js验证手机号码
 

验证手机号码 
 
 
 
 
 
 
 
 
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.