请帮帮我。我在正则表达式领域没有有效的想法
答案 0 :(得分:3)
这是一种可能的解决方案:
^\+?(?:\d-?){9,14}\d$
说明:
^ # anchor the pattern to the beginning of the string
\+? # optional literal +
(?:\d-?) # a digit, followed by an optional hyphen
{9,14} # 9 to 14 of those
\d # another digit (to make that 10 to 15, and disallow hyphens at the end)
$ # anchor the pattern to the end of the string