It is unit tested with 100% code coverage and can be considered fit for production.The project can be found on Git Hub where you can also find our issue tracker.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. allows the validators object and validator options to be a function that should return the constraints/options: Validates the attributes object against the constraints.
The message can also be a function which will be called to retrieve the message, besides this it is treated like a normal message (the attribute name is prepended etc).
With all of this in mind, let’s look at the regular expression again after breaking it into its pieces. : # Group but don't capture: [0-9] # Match a digit. ITU-T Recommendation E.123 (“Notation for national and international telephone numbers, e-mail addresses and web addresses”) can be downloaded at
Because this version is written using free-spacing style, the literal space character has been replaced with ^ # Assert position at the beginning of the string. ITU-T Recommendation E.164 (“The international public telecommunication numbering plan”) can be downloaded at RFC 5733 defines the syntax and semantics of EPP contact identifiers, including international phone numbers. Techniques used in the regular expressions in this recipe are discussed in Chapter 2.
We have also used Java Script to get the valued entered in the form and displayed it as the user clicks Submit button.
If a programmer enters a wrong phone number or mobile number or enters email-id in a different format, it shows an error message and asks the user the correct phone number and email-id.