Version Affected: All
How to write a Regex (Regular Expression) that matches the ITU E.123 and E.164 formats.
The SecureAuth Best Practices guide mentions that phone numbers should be formatted as per ITU E.123 and/or E.164:
Use the following regex:
This is comprised of 3 regular expressions combined:
matches a 1 to 3 digit country code followed by a space, then 2 to 3 digits, another space, another 2 to 3 digits a final space then 4 digits, e.g.:
+1 123 456 7890
+31 42 123 4567
matches the standard national US 3-3-4 number format. A 3 digit area code in brackets, followed by a space, then 3 more digits, followed by another space then 4 digits e.g.:
(112) 123 4567
Note the area code must be in brackets.
matches a 1 to 3 digit country code followed by a space then between 1 and 14 digits, optionally followed by another space and up to 13 further digits, e.g.:
+44 1234 567890
Note: E.164 allows for a maximum of 15 digits, up to 3 of which are the country code, therefor the second grouping of 14 digits can complete the number. The optional 13 characters are to allow for countries that traditionally have a space between their area code and the local number.
To enforce a Regex for a phone number field see these documents for more information
SecureAuth Knowledge Base Articles provide information based on specific use cases and may not apply to all appliances or configurations. Be advised that these instructions could cause harm to the environment if not followed correctly or if they do not apply to the current use case.
Customers are responsible for their own due diligence prior to utilizing this information and agree that SecureAuth is not liable for any issues caused by misconfiguration directly or indirectly related to SecureAuth products.
Please sign in to leave a comment.