如何构建regx以验证电话号码?那就是:
我尝试过这种模式:
^[04,050]\\d{8,13}
任何人都可以帮助我吗?
答案 0 :(得分:3)
让我们分解(希望我理解正确):
^ # Start of string
(?: # Match one of the following:
04\d{6,11} # Either an 8-13 digit number starting with 04
| # or
050\d{5,10} # an 8-13 digit number starting with 050
| # or
4[0-25-9]\d{6} # an 8 digit number starting with 4 but not 43 or 44
| # or
9\d{7} # an 8 digit number starting with 9
) # End of alternation
$ # End of string