Shell Problems#193 Valid Phone Numbers
784

the easy shell problem, look details, just to valid the phone numbers.

I use regex with egrep, and the result is wrong, with reason:

Input:
123-456-7891
Output:
Expected:
123-456-7891

But I test with my shell command:

egrep -i '(\d{3}-|\(\d{3}\)\s)\d{3}-\d{4}' file.txt  

it works well.

I donnot know why, who could give me some tips, thanks very much for this.

Comments (1)