Reputation: 7605
My numbers looks like (###) ###-####
There is a space between the ) and the next digit or my number can look like (###) ###-#### ext ####
space after the ext and the )
Can someone tell me what regex needs to be performed to verify if either one is valid. Please note that the extension needs to be 4 digits if one is present.
I found this RegEx expression on the web
Regex.Match(number, @"^(\+[0-9]{9})$").Success
Unfortunately I am not very good at RegEx to understand or modify that
Upvotes: 0
Views: 556
Reputation: 35270
How about this pattern:
@"^\(\d{3}\) \d{3}-\d{4}( ext \d{4}){0,1}$"
Upvotes: 1