本文介绍了验证 10 位电话号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个简单的正则表达式来验证 10 位电话号码.我想确保数字正好是 10 位数字,没有字母、连字符或括号,并且前两位数字不是以 0 或 1 开头.有人可以帮忙吗?
I'm looking for a simple regex that will validate a 10 digit phone number. I'd like to make sure that the number is exactly 10 digits, no letters, hyphens or parens and that the first two digits do not start with 0 or 1. Can someone help out?
推荐答案
/[2-9]{2}\d{8}/
/[2-9]{2}\d{8}/
这篇关于验证 10 位电话号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!