Login to follow
PhoneNumberValidator

PhoneNumberValidator (ODC)

Stable version 0.6.3 (Compatible with ODC)
Uploaded on 21 Feb by António Pereira
PhoneNumberValidator

PhoneNumberValidator (ODC)

Documentation
0.6.3
Structures

PhoneNumberInfo

Validation and identification details for a phone number.


FieldTypeDescription
IsValidBooleanTrue if the phone number is valid.
IsPossibleNumberBooleanTrue if the number could possibly be valid (less strict). Useful for partial input validation.
PhoneNumberTypeTextMOBILE, FIXED_LINE, FIXED_LINE_OR_MOBILE, TOLL_FREE, PREMIUM_RATE, SHARED_COST, VOIP, PERSONAL_NUMBER, PAGER, UAN, VOICEMAIL, or UNKNOWN.
CountryCodeIntegerCountry calling code (e.g., 1 for US/CA, 351 for PT, 44 for GB). 0 if parsing fails.
DetectedRegionCodeTextDetected ISO 3166-1 alpha-2 code (e.g., US, PT). May differ from input regionCode.


PhoneNumberFormats

The phone number in standard formatted representations.


FieldTypeDescription
InternationalTexte.g., +1 650-253-0000
NationalTexte.g., (650) 253-0000
E164Texte.g., +16502530000 — recommended format for storage.
RFC3966Texte.g., tel:+1-650-253-0000 — useful for tel: hyperlinks.


Actions

PhoneNumberValidate

Parses and validates a phone number. Returns validation details and formatted representations.


DirectionParameterTypeDescription
InputphoneNumberTextThe phone number to validate. Accepts international (+1 650-253-0000) or national ((650) 253-0000) format.
InputregionCodeTextISO 3166-1 alpha-2 code (e.g., US, PT, GB). Required for national format. Can be empty for + prefixed numbers.
OutputphoneNumberInfoPhoneNumberInfoValidation and identification details.
OutputphoneNumberFormatsPhoneNumberFormatsThe number in all standard formats.


PhoneNumberFormat

Formats a phone number into all standard representations.


DirectionParameterTypeDescription
InputphoneNumberTextThe phone number to format.
InputregionCodeTextISO 3166-1 alpha-2 code. Required for national format.
OutputsuccessBooleanTrue if the number was parsed and formatted successfully.
OutputerrorMessageTextError details on failure; empty on success.
OutputphoneNumberFormatsPhoneNumberFormatsThe number in all standard formats.


PhoneNumberMatch

Compares two phone numbers to determine if they refer to the same line.


DirectionParameterTypeDescription
InputphoneNumber1TextFirst phone number.
InputphoneNumber2TextSecond phone number.
InputregionCodeTextDefault region for parsing numbers in national format.
OutputisMatchBooleanTrue if the numbers match (EXACT_MATCH or NSN_MATCH).
OutputmatchTypeTextEXACT_MATCH, NSN_MATCH, SHORT_NSN_MATCH, NO_MATCH, or NOT_A_NUMBER.
OutputerrorMessageTextIndicates which phone number failed to parse; empty when both are parseable.


PhoneNumberGetRegion

Detects the region (country) and country calling code for a phone number.


DirectionParameterTypeDescription
InputphoneNumberTextThe phone number to analyze. Best results with + prefix.
InputregionCodeTextDefault region for parsing numbers in national format.
OutputsuccessBooleanTrue if the number was parsed successfully.
OutputerrorMessageTextError details on failure; empty on success.
OutputdetectedRegionCodeTextDetected ISO 3166-1 alpha-2 code (e.g., US, PT, GB).
OutputcountryCodeIntegerCountry calling code (e.g., 1, 351, 44).


Usage Notes
  • regionCode is an ISO 3166-1 alpha-2 code (e.g., US, PT, GB). It is case-insensitive and whitespace-tolerant — us, PT both work.
  • Provide regionCode when the phone number is in national format (no + prefix). When the number is in international format (e.g., +351912345678), regionCode can be left empty.
  • Store phone numbers in E.164 format (e.g., +16502530000) for best interoperability across systems.
  • Invalid or unparseable phone numbers return IsValid = False / success = False with default output values — they do not throw exceptions. Only a null phone number input throws an exceptio