grep是否支持组中的OR?

时间:2015-09-10 02:53:28

标签: shell grep

我正在看这个问题:https://leetcode.com/problems/valid-phone-numbers/

要求使用cmd提取电话号码。

我发现这个命令有效:

-webkit-transform-origin:0% 55%;
transform-origin:10 100%;

虽然失败了:

cat file.txt | grep -Eo '^(\([0-9]{3}\) ){1}[0-9]{3}-[0-9]{4}$|^([0-9]{3}-){2}[0-9]{4}$'

我不知道为什么第二次失败了。是因为 grep 不支持组中的OR吗?

0 个答案:

没有答案