我想要包含 10 位数字的印度手机号码的正则表达式。
应该匹配的数字以 9 或 8 或 7 开头。
例如:
9882223456
8976785768
7986576783
不应与以 1 到 6 或 0 开头的数字匹配。
请您参考如下方法:
^[789]\d{9}$
应该可以解决问题。
^ #Match the beginning of the string
[789] #Match a 7, 8 or 9
\d #Match a digit (0-9 and anything else that is a "digit" in the regex engine)
{9} #Repeat the previous "\d" 9 times (9 digits)
$ #Match the end of the string
更新
印度的一些电信运营商推出了以数字 6 开头的新移动号码系列。
用于该用途:
^[6-9]\d{9}$