I am making an input form for registering employees. I thought the number format in any country would fit in /\+(\d+)-\d\d\d-\d\d\d-\d\d\d\d/
, where (\d+) is country code I assume to have different length and next goes exactly 10 digits. I need to create input fields and validation rules to make input as protected and unambiguous as possible but I am also worried if there could be actual numbers that don't fit this regex. Is there a safe international standard way of writing numbers?
Asked
Active
Viewed 1,159 times
-1
1 Answers
1
There is no particular format which you can apply for all the countries phone number.
However \d*
will be one of the choice with which you can proceed with but that too is not the best.
You may check National conventions for writing telephone numbers

Rahul Tripathi
- 168,305
- 31
- 280
- 331
-
I do not think hyphens, spaces or whatever are that important, as this is only for convenience. I was mostly concerned about an overall number of digits next to the country code. Are there countries with more or less digits? – Gherman Aug 30 '14 at 09:02
-
1@German:- Yes there are countries having different number of digits. – Rahul Tripathi Aug 30 '14 at 09:03
-
@German:- The wiki link which I have added in the answer will help you in identifying those countries. For example Netherland have 8 digit number and India has 10 digit. Now there is a difference in digits in mobile and landline number as well – Rahul Tripathi Aug 30 '14 at 09:04