I would like to get the phone numbers from a file. I know the numbers have different forms, I can handle for a single one, but don't know how to get a uniform regex. For example
- xxx-xxx-xxxx
- (xxx)xxx-xxxx
- xxx xxx xxxx
- xxxxxxxxxx
I can only handle 1, 2, and 4 together
grep '[0-9]\{3\}[ -]\?[0-9]\{3\}[ -]\?[0-9]\{4\}' file
Is there any one single regex can handle all of these four forms?
 
     
     
     
     
     
     
     
     
     
     
     
     
    