https://leetcode.com/problems/valid-phone-numbers/description/
Shell脚本题目:给file.txt ,输出复合格式的电话号码。思路是使用正则,但是有几个坑。



grep -P "^(\d{3}-|\(\d{3}\) )\d{3}-\d{4}$" file.txt