Phone Number Normalization

If you are using phone numbers as identifiers, you must pre-process or normalize the numbers before passing them to the ATS SDK to get the best match rate. Follow our recommendations below to learn how.

1. Validate the Numbers Against Regular Expression

Validate the phone numbers against the following RegEx:

private static final Pattern ALFA_NUMERICS_PATTERN = Pattern.compile("[^0-9]");
  private static final Pattern LEADING_ZEROS_PATTERN = Pattern.compile("^0+(?!$)");

2. Remove non-numerical characters

Use the following command to remove non-numerical characters from phone numbers:

phoneNumber = ALFA_NUMERICS_PATTERN.matcher(phoneNumber).replaceAll("");

3. Remove leading 0s

Use the following command to remove non-numerical characters from phone numbers if it exists:

phoneNumber = LEADING_ZEROS_PATTERN.matcher(phoneNumber).replaceFirst("");