我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

手机验证器

I have a problem with regex, I want to create pattern which will be check mobile number.

Mobile number starts with /^(50|51|53|57|60|66|69|72|73|78|79|88)/ and has only 9 digits.

Could You help me?

You could use a regex like following

$isMobileNumber = preg_match('/^(50|51|53|57|60|66|69|72|73|78|79|88)\d{7}/', $number);

You can use the following regex for that:

(?:5[01357]|6[069]|7[2389]|88)\d{7}

Regular expression visualization

Debuggex Demo

近期文章

  • 错误:mysqli_fetch_object()期望参数1为mysqli_result
  • 使用PHP回显没有空格的字符串
  • 不受保护的mysql查询总是受到关注吗? [关闭]
  • 在php中返回Integer而不是boolean
  • Php foreach循环键打印特定值[关闭]
  • 是否可以删除php或jquery中的<img>中的<a>而不直接在php中删除<a>?
  • PHP - 标题错误[重复]
  • 使用php [关闭]从网页上的数据库显示信息
  • 未定义的索引(PHP)
  • 尝试使用mysql结果集在while循环中构建数组的PHP语法错误[关闭]
  • PHP连接错误[关闭]
  • 拆分php数组[关闭]
  • 在结果之间添加空格[关闭]
  • PHP是否需要使用MySQL? [关闭]
  • PHP - start_session undefined [关闭]
  • $ rows = array()[关闭]的用途是什么
  • 从IP地址查找国家/地区名称[重复]
  • php foreach声明中的&是什么? [重复]
  • INSERT INTO不能正常运行
  • Php会话无法处理输入

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华