Version Affected: All
Overview
SecureAuth's Best Practices for Phone Number and Email Formatting guide recommends formatting phone numbers per ITU E.123 and/or E.164. The following regular expression matches both:
The Combined Regular Expression
^\+\d{1,3}\s\d{2,3}\s\d{2,3}\s\d{4}|^\+\d{1,3}\s\d{1,14}(\s\d{1,13})?|^\(\d{3}\)\s\d{3}\s\d{4}?It's made up of 3 separate patterns, combined with | (OR):
1. E.123, international format
^\+\d{1,3}\s\d{2,3}\s\d{2,3}\s\d{4}Matches a 1-3 digit country code, a space, 2-3 digits, a space, 2-3 more digits, a space, then 4 digits. For example:
- +1 123 456 7890
- +31 42 123 4567
2. E.123, US national format
^\(\d{3}\)\s\d{3}\s\d{4}?Matches the standard US national 3-3-4 format: a 3-digit area code in parentheses, a space, 3 digits, a space, then 4 digits. The area code must be in parentheses. For example:
- (112) 123 4567
3. E.164
^\+\d{1,3}\s\d{1,14}(\s\d{1,13})?Matches a 1-3 digit country code, a space, then 1-14 digits, optionally followed by another space and up to 13 more digits. For example:
- +44 1234 567890
- +44 1234567890
E.164 allows a maximum of 15 digits total, up to 3 of which are the country code -- the second group of up to 14 digits covers the rest of the number. The optional trailing group of up to 13 digits accommodates countries that conventionally put a space between their area code and local number.
Special Considerations
To enforce this pattern on a phone number field, see Self-Service Account Update Page Configuration and How To: Restrict Allowed Information on the Employee Self Service Page.
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.
Comments
Please sign in to leave a comment.