Can you solve this real interview question? Valid Phone Numbers - Given a text file file.txt that contains a list of phone numbers (one per line), write a one-liner bash script to print all valid phone numbers. You may assume that a valid phone number m
[LeetCode] Valid Phone Numbers 验证电话号码 Given a text filefile.txtthat contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may assume that a valid phone number must appear in one of the following two formats: (xxx) xxx...
[Leetcode]193.valid-phone-numbers 题目 Valid Phone Numbers Given a text filefile.txtthat contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may assume that a valid phone number must appear in one of the following two format...
leetcodePython【193】: Valid Phone Numbers https://leetcode.com/problems/valid-phone-numbers/description/ 使用grep -P是POSIX正则规范。 \d是非常规正则 grep-P"^(\\d{3}-|\\(\\d{3}\\) )\\d{3}-\\d{4}$"file.txt 所以,如果用grep -E 或者 egrep的时候,如下:...
LeetCode: 193. Valid Phone Numbers 题目描述 Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may assume that a valid phone number must appear in one of the following two ...
https://leetcode.com/problems/valid-phone-numbers/description/ Shell脚本题目:给file.txt ,输出复合格式的电话号码。思路是使用正则,但是有几个坑。 注意grep -E 与grep -P 的区别 https://www.jianshu.com/p/e1acfb7989b2 -E 其实是扩展支持|与& 这种方式,-P才是Perl正则 ...
Your script should output the following valid phone numbers: 987-123-4567 (123) 456-7890 解答 https://leetcode.com/problems/valid-phone-numbers/discuss/55478/Grep-e-solution-with-detailed-explanation-good-for-those-new-to-regex 1grep-e'\(^[0-9]\{3\}-[0-9]\{3\}-[0-9]\{4\}$\...
Given a text filefile.txtthat contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may assume that a valid phone number must appear in one of the following two formats: (xxx) xxx-xxxx or xxx-xxx-xxxx. (x means a digit...
https://oj.leetcode.com/problems/valid-parentheses/ Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid. The brackets must close in the correct order,"()"and"()[]{}"are all valid but"(]"and"([)]"are not. ...
Given a text filefile.txtthat contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may assume that a valid phone number must appear in one of the following two formats: (xxx) xxx-xxxx or xxx-xxx-xxxx. (x means a digit...