In this article we will discuss about regular expression for validating Phone number in various format.
below is the code for validating mobile number with enter only numeric, length must be 10 digits and restrict user to entering illegal characters.
There is two ways given below for validation of mobile numbers first normal way and another through regular expression.
Thanks to the international phone numbering plan (ITU-T E.164), phone numbers cannot contain more than 15 digits. The significance of this is that EPP-style international phone numbers are increasingly used and recognized, and therefore provide a good alternative format for storing (and validating) international phone numbers.
The shortest international phone numbers in use contain seven digits. EPP-style phone numbers use the format Recipe 4.2 provides more options for validating North American phone numbers.
If the number is valid then alert message will be displayed as ‘Phone number is valid’.