0

Solve this regex in shell script

Accept a string and return True if it is in the form of following phone number. (123) 456-7890 where the number can be any [0-9]

26th Aug 2017, 11:07 PM
Nawaz
Nawaz - avatar
1 Answer
0
off hand I believe its (r'(\d{3})\s\d{3}-\d{4}') r is the regulator expression, then in quotes, then open perens, \d{3} says 3 numbers only, \s is a space... with that you should understand the rest. However you may need a \w instead of each parentheses... I did not check this code.
3rd Sep 2017, 6:39 AM
adam harms
adam harms - avatar