有问题的正则表达式是
(\d{3,4}[.-]?)+
Run Code Online (Sandbox Code Playgroud)
示范文本
707-7019-789
Run Code Online (Sandbox Code Playgroud)
我到目前为止的进展
( )+ a capturing group, capturing one or more
\d{3,4} digit, in quantities 3 or 4
[.-]? dot (or something) or hyphen, in quantities zero or one <-- this is the part I'm interested in
Run Code Online (Sandbox Code Playgroud)
根据我的理解,这应该匹配3或4位数字,然后是一个点(或任何东西,因为点匹配任何东西)或连字符,捆绑在一个组中,一次或多次.为什么这不符合
707+123-4567
Run Code Online (Sandbox Code Playgroud)
然后?