正则 手机号

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

[代码][PHP]代码

1 if(preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$mobilephone)){
2 //验证通过
3
4 }else{
5 //手机号码格式不对
6
7 }
[代码][JavaScript]代码
01 $("#smForm").validate({
02 rules: {
03 smMobilePhone: {
04 required:true
05 digits:06 range:[13000000000,18999999999]
07 }
08 },monospace!important; font-size:10pt!important; min-height:auto!important; display:block!important">09 messages: {
10 smMobilePhone: {
11 required:"您没有填写手机号码"12 digits:"手机号码格式不对"13 range:"手机号长度或者格式不对"14 }
15 16 preErrs : {
17 18 }
原文链接:https://www.f2er.com/regex/363041.html

猜你在找的正则表达式相关文章