手机号码,密码正则验证

前端之家收集整理的这篇文章主要介绍了手机号码,密码正则验证前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_502_0@/**

  • 手机号码
  • 移动:134[0-8],135,136,137,138,139,150,151,157,158,159,182,187,188
  • 联通:130,131,132,152,155,156,185,186
  • 电信:133,1349,153,180,189
    /
    NSString
    MOBILE = @"^1(3[0-9]|5[0-35-9]|8[025-9])\d{8}$";
    /**
  • 中国移动:China Mobile
  • 134[0-8],188
    /
    NSString
    CM = @"^1(34[0-8]|(3[5-9]|5[017-9]|8[278])\d)\d{7}$";
    /**
  • 中国联通:China Unicom
  • 130,186
    /
    NSString
    CU = @"^1(3[0-2]|5[256]|8[56])\d{8}$";
    /**
  • 中国电信:China Telecom
  • 133,189
    /
    NSString
    CT = @"^1((33|53|8[09])[0-9]|349)\d{7}$";
    /**
  • 大陆地区固话及小灵通
  • 区号:010,020,021,022,023,024,025,027,028,029
  • 号码:七位或八位
    /
    // NSString
    PHS = @"^0(10|2[0-5789]|\d{3})\d{7,8}$";


    @H_502_0@密码
    ^(?=.?[a-zA-Z])(?=.?[0-9])[a-zA-Z0-9]{6,20}$


    <p style="padding-bottom: 0px; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; padding-left: 0px; letter-spacing: normal; padding-right: 0px; font: 14px/25px verdana,Arial,Helvetica,sans-serif; white-space: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">"^\d+$"  //非负整数(正整数 + 0)<span class="Apple-converted-space">

    "^[0-9][1-9][0-9]$"  //正整数<span class="Apple-converted-space">

    "^((-\d+)|(0+))$"  //非正整数(负整数 + 0)<span class="Apple-converted-space">

    "^-[0-9][1-9][0-9]$"  //负整数<span class="Apple-converted-space">

    "^-?\d+$"    //整数<span class="Apple-converted-space">

    "^\d+(.\d+)?$"  //非负浮点数(正浮点数 + 0)<span class="Apple-converted-space">

    "^(([0-9]+.[0-9][1-9][0-9])|([0-9][1-9][0-9].[0-9]+)|([0-9][1-9][0-9]))$"  //正浮点数<span class="Apple-converted-space">

    "^((-\d+(.\d+)?)|(0+(.0+)?))$"  //非正浮点数(负浮点数 + 0)<span class="Apple-converted-space">

    "^(-(([0-9]+.[0-9][1-9][0-9])|([0-9][1-9][0-9].[0-9]+)|([0-9][1-9][0-9])))$"  //负浮点<span class="Apple-converted-space">

    数<span class="Apple-converted-space">

    "^(-?\d+)(.\d+)?$"  //浮点数<span class="Apple-converted-space">

    "^[A-Za-z]+$"  //由26个英文字母组成的字符串<span class="Apple-converted-space">

    "^[A-Z]+$"  //由26个英文字母的大写组成的字符串<span class="Apple-converted-space">

    "^[a-z]+$"  //由26个英文字母的小写组成的字符串<span class="Apple-converted-space">

    "^[A-Za-z0-9]+$"  //由数字和26个英文字母组成的字符串<span class="Apple-converted-space">

    "^\w+$"  //由数字、26个英文字母或者下划线组成的字符串<span class="Apple-converted-space">

    "^[\w-]+(.[\w-]+)@[\w-]+(.[\w-]+)+$"    //email地址<span class="Apple-converted-space">

    "^[a-zA-z]+://(\w+(-\w+)
    )(.(\w+(-\w+)))(\?\S)?$"  //url<span class="Apple-converted-space">

    /^13\d{9}$/gi手机号正则表达式


    <p style="padding-bottom: 0px; text-transform: none; background-color: rgb(255,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">

    public static bool IsValidMobileNo(string MobileNo)<span class="Apple-converted-space">

    {<span class="Apple-converted-space">

    const string regPattern = @"^(130|131|132|133|134|135|136|137|138|139)\d{8}$";<span class="Apple-converted-space">

    return Regex.IsMatch(MobileNo,regPattern);<span class="Apple-converted-space">

    }


    <p style="padding-bottom: 0px; text-transform: none; background-color: rgb(255,51); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">

    正则表达式--验证手机号码:13[0-9]{9}<span class="Apple-converted-space">

    实现手机号前带86或是+86的情况:^((+86)|(86))?(13)\d{9}$<span class="Apple-converted-space">

    电话号码与手机号码同时验证:(^(\d{3,4}-)?\d{7,8})$|(13[0-9]{9})<span class="Apple-converted-space">

    提取信息中的网络链接:(h|H)(r|R)(e|E)(f|F)
    = ('|")?(\w|\|\/|.)+('|"| |>)?<span class="Apple-converted-space">

    提取信息中的邮件地址:\w+([-+.]\w+)@\w+([-.]\w+).\w+([-.]\w+)<span class="Apple-converted-space">

    提取信息中的图片链接:(s|S)(r|R)(c|C)
    = ('|")?(\w|\|\/|.)+('|"| |>)?<span class="Apple-converted-space">

    提取信息中的IP地址:(\d+).(\d+).(\d+).(\d+)<span class="Apple-converted-space">

    提取信息中的中国手机号码:(86)013\d{9}<span class="Apple-converted-space">

    提取信息中的中国固定电话号码:((\d{3,4})|\d{3,4}-|\s)?\d{8}<span class="Apple-converted-space">

    提取信息中的中国电话号码(包括移动和固定电话):((\d{3,4}-|\s)?\d{7,14}<span class="Apple-converted-space">

    提取信息中的中国邮政编码:[1-9]{1}(\d+){5}<span class="Apple-converted-space">

    提取信息中的中国身份证号码:\d{18}|\d{15}<span class="Apple-converted-space">

    提取信息中的整数:\d+<span class="Apple-converted-space">

    提取信息中的浮点数(即小数):(-?\d).?\d+<span class="Apple-converted-space">

    提取信息中的任何数字 :(-?\d
    )(.\d+)?<span class="Apple-converted-space">

    提取信息中的中文字符串:[\u4e00-\u9fa5]<span class="Apple-converted-space">

    提取信息中的双字节字符串 (汉字):[^\x00-\xff]
    <span class="Apple-converted-space">

猜你在找的JavaScript相关文章