Phone Number Cleaner
The phone number formatting/verification algorithm consists of validation and correction phase using the North America Numbering Plan (NANP) format or International format.
In the NANP format, the system conformity to the standard verifies two key elements:
Capture the correct number of digits. Capture the area code value plus the base seven-digit phone number for domestic phone numbers.
Submit domestic phone numbers in an appropriate format for a domestic phone number, as represented in the following examples.
You many combine the following formats to form valid combinations. This list is not exhaustive.
(512)652.2600
512 652 2600
512-652-2600
512.652.2600
512/652/2600
5126522600
In the International format:
A valid international number is defined as a string of digits separated into groups of two, three, or four digits by one of the following characters: dot (.), forward slash (/), hyphen (-), or space ( ).
The first group of digits can be surrounded by parentheses.
The phone number string may be preceded by the 'plus' symbol '+' indicating an international phone number.
The string may be between ten and fifteen digits, with the expectation that strings of length exceeding thirteen digits contain the '011' prefix combination of digits indicating an international phone number.
Below is a functional description of the algorithm used to format, validate, and verify phone numbers captured from the constituent.
Phase 1: Format Validation:
The phone number string received from the constituent input is split into two parts: number and extension.
The number is checked to determine if it is in the North America Numbering Plan (NANP) format. If the submitted number matches one of the possible format options, the validation is deemed successful.
If the submitted number does not match one of the possible NANP formats, the number is then checked to determine if it is an International number, matching one of the international format options. If the number does not match any of the possible International formats, the validation algorithm prompts the user interface to inform the constituent of the verification error and requests correction.
Phase 2: Format Correction:
Phone number format correction is performed only on phone number strings successfully passing the first validation phase.
Format Correction Algorithm:
Number and extension (if present) are corrected separately and then concatenated.
Phone number extension correction transforms the received string into ‘ext ABC’ where ABC represents the numeric string value representing the extension. See the s ection below on extension input guidelines for valid formats.
All non-numeric characters are removed, and the remaining numeric characters are written to the constituent record.
Extension Input Format Guidelines:
A valid extension is a string consisting of: a prefix, zero or more white spaces, and a group of digits.
A valid prefix is one of: extension, ext, x followed be an optional character dot (.) or colon (:)
A group of digits is defined a group of integer values [0-9].
Examples of valid extensions:
ext.234
ext234
ext:234
ext*234
x.234
x234
x. 234
x 234
extension 234
extension. 234
extension 234