Skip to content

Phone Number

Type Registry

Phone Number

identity.person.phone_number

Telephone number in various formats. Locale-specific due to digit grouping, area code positions, and formatting conventions (e.g., US +1 (xxx) xxx-xxxx vs EU +xx-xxx-xxx-xxxx). May include country code, area code, and extension.

Domain identityperson
Casts to VARCHAR
Scope Locale-specific
Locales EN, EN_AU, EN_GB, EN_CA, EN_US, DE, FR, ES, IT, NL, PL, RU, JA, ZH, KO, AR, ZA

Try it

CLI
$ finetype infer -i "+1 (555) 123-4567"
→ identity.person.phone_number

DuckDB

Detect
SELECT finetype('+1 (555) 123-4567');
-- → 'identity.person.phone_number'
Cast expression
CAST({col} AS VARCHAR)
Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS VARCHAR) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'identity.person.phone_number';

Struct Expansion

area_code: REGEXP_EXTRACT({col}, '[^0-9]([0-9]{3})[^0-9]')
country_code: REGEXP_EXTRACT({col}, '^\+?([0-9]{1,3})')
digits_only: REGEXP_REPLACE({col}, '[^0-9]', '')

JSON Schema

finetype schema identity.person.phone_number
{
  "$id": "https://noon.sh/schemas/identity.person.phone_number",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Telephone number in various formats. Locale-specific due to digit grouping, area code positions, and formatting conventions (e.g., US +1 (xxx) xxx-xxxx vs EU +xx-xxx-xxx-xxxx). May include country code, area code, and extension.",
  "examples": [
    "+1 (555) 123-4567",
    "555-123-4567",
    "+44 20 7946 0958",
    "+33 1 42 68 53 00",
    "07911 123456"
  ],
  "maxLength": 30,
  "minLength": 7,
  "pattern": "^[+]?[0-9\\s()\\-\\./\\u2013]+([\\s]*(ext\\.?|Ext\\.?|x|#)[\\s]*\\d{1,5})?([\\s]*(Work|Cell|Fax|Home|Office))?$",
  "title": "Phone Number",
  "type": "string"
}

Examples

+1 (555) 123-4567555-123-4567+44 20 7946 0958+33 1 42 68 53 0007911 123456

Also known as

telephonephone

Types in identity