使用正则表达式验证美国手机/手机号码吗? [英] Validating USA cell/mobile phone numbers with regex?

查看:620
本文介绍了使用正则表达式验证美国手机/手机号码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要写验证信息来检查电话号码是否为有效的美国手机/手机号码.我找到了固定电话的示例,但没有找到手机/移动电话的示例.有人可以为此指出正确的方向吗?

I need to write validation to check if a phone number is a valid USA cell / mobile phone number. I have found examples for landlines but not cell / mobile phones. Can anyone point me in the right direction with this?

推荐答案

,您可以使用Google的电话号码处理库.也许比正则表达式更好. 此处: https://github.com/giggsey/libphonenumber-for-php

you can use Google's phone number handling library. Maybe better than regex. Here: https://github.com/giggsey/libphonenumber-for-php

这篇关于使用正则表达式验证美国手机/手机号码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆