c# - Phone Number Regex -


i need regular expression phone number includes country code, area code , phone number.the phone number format should like: 001-253-3478887 or 90-312-4900203. try not work. should correct format? how can phone number info?

(\(\d{3}-))?\d{3}-\d{4} 

^((\d-\d{3})|(\d{1,3}))\-\d{3}-\d{7}$ 

this regex match country codes. country codes of 1 , 1-684 won't valid in other answers. prevent country codes such 1-42 being allowed, since time there should separator in country code when it's 4 digits long. if end getting 4 digit country codes without separator, use following instead:

^((\d{4})|(\d{1,3}))\-\d{3}-\d{7}$ 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -