[Enhancement]: Validation for Phone Numbers does not currently include extensions
sachin-shrestha opened this issue · comments
Description of Enhancement :
Pattern to validate phone numbers according to ITU E.123 international notation does not allow adding phone number extensions.
Current regex pattern is: "^\+\d{1,3}\s\d{2,3}\s\d{2,3}\s\d{4}$"
Above pattern validates phone numbers like:
+1 617 208 1394
but needs to validate phone with either "extension" or "ext." such as:
+1 617 208 1394 ext. 100
or
+1 617 208 1394 extension 100
Propose following pattern: ^+\d{1,3}\s\d{2,3}\s\d{2,3}\s\d{4}(?:\s(ext.|extension)\s\d+)?$
Why is this Needed?
Common to have phone numbers with extensions.
Anything else we need to know?
This wiki page (https://en.wikipedia.org/wiki/E.123) suggests the following:
The non-dialable PBX (private branch exchange) extension number should be separated by words "extension" or "ext." in the national language after the phone number.