# Phone number regex by country, tested against libphonenumber

> Tested mobile number regexes for 13 countries, from the US to Australia, checked against libphonenumber 9.0.43 on 1.3 million strings. JS, Python and PHP code.

Canonical: https://mobilevalidate.com/blog/phone-number-regex-by-country · Last updated: 2026-11-24

![Dark code panel with six country-code rows, each ending in a match or no-match badge, feeding a funnel that splits into a metadata database with a release timeline and a bar chart whose longest bars are red.](https://mobilevalidate.com/images/blog/phone-number-regex-by-country.svg)

*A per-country regex is a snapshot: loose patterns let bad numbers through, and strict ones go stale.*


By MobileValidate team (https://mobilevalidate.com/about) · Published: 2026-11-24 · Category: Developers · Tags: Regex, Phone validation, Libphonenumber, E.164, Data quality

A phone number regex only works per country, and only after the number is normalized to E.164. Below are tested mobile patterns for 13 countries. For 10 of them the long version is copied from libphonenumber's metadata and matched the library exactly on 100,000 test strings each. The short patterns most tutorials give let through numbers the library rejects: between 1.2% (UK) and 58.2% (Mexico) of their matches. Use the regex as a quick filter or a storage check, and let a library or a live check decide.

## How did we build and test these regexes?

We took each country's mobile pattern from libphonenumber's [`PhoneNumberMetadata.xml`](https://github.com/google/libphonenumber/blob/master/resources/PhoneNumberMetadata.xml), version 9.0.43 (released 4 November 2026). We added the `+` and country code and checked lengths against the metadata. The result is the **strict** pattern. Next to it is a **quick** pattern, the short form tutorials usually give. For the US, Canada, India and Mexico, the metadata patterns run from 215 to 915 characters, so we give only the quick form for three of them. Canada's 215-character pattern is worth having, because it is the only way a regex can tell Canada from the US.

Then we ran both against the libraries, on 2026-11-07:

- **Random strings.** 100,000 per country: `+`, the country code and 8 to 12 random digits, half of them starting with the digit a mobile number starts with. Seeded, so the run repeats. We compared each regex with Python `phonenumbers` 9.0.43, which the Python Package Index lists as released on 6 November 2026, and with libphonenumber-js 1.13.15, the newest on npm that day.
- **Named cases.** libphonenumber's own example numbers, one digit too short or too long, real block boundaries and the traps below. We ran the same 39 inputs through Python `re`, JavaScript `RegExp` (Node.js 24) and PHP `preg_match` (PHP 8.3.6). All three engines gave the same answer on every input.

All patterns expect a normalized string such as `+33612345678`: no spaces, no national `0`, no `00`. The general E.164 pattern `^\+[1-9]\d{1,14}$` checks that shape only; our post on [why the E.164 regex is not enough](/blog/e164-regex-is-not-enough) has the counterexamples, so we don't repeat them here.

## What are the mobile regexes for each country?

Copy them from this block. `quick` is the short form; `strict` follows the 9.0.43 metadata. For the US, Canada and Mexico the patterns cover every geographic number, because mobile and fixed lines share ranges there.

```text
# North America (NANP: US, Canada, Caribbean): geographic numbers
US quick   ^\+1[2-9]\d{2}[2-9]\d{6}$
CA strict  ^\+1(?:2(?:04|[23]6|[48]9|5[07]|[67]3)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\d{6}$

# United Kingdom: mobiles (GB only, not Jersey, Guernsey or the Isle of Man)
GB quick   ^\+447[1-57-9]\d{8}$
GB strict  ^\+447(?:457[0-57-9]\d{5}|700[01]\d{5}|911[028]\d{5}|(?:[1-3]\d\d|4(?:[0-46-9]\d|5[0-689])|5(?:0[0-8]|[13-9]\d|2[0-35-9])|7(?:0[1-9]|[1-7]\d|8[02-9]|9[0-689])|8(?:[014-9]\d|[23][0-8])|9(?:[024-9]\d|1[02-9]|3[0-689]))\d{6})$

# India: mobiles
IN quick   ^\+91[6-9]\d{9}$

# Germany: mobiles
DE quick   ^\+491(?:5\d|6[023]|7\d)\d{7,8}$
DE strict  ^\+49(?:15(?:[0-25-9]\d\d|3(?:10|33)|410)\d{6}|1(?:6[023]|7\d)\d{7,8})$

# France: mobiles
FR quick   ^\+33[67]\d{8}$
FR strict  ^\+33(?:6(?:[0-24-8]\d|3[0-8]|9[589])|7[3-9]\d)\d{6}$

# Brazil: mobiles
BR quick   ^\+55[1-9]{2}9\d{8}$
BR strict  ^\+55(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])(?:7|9\d)\d{7}$

# Indonesia: mobiles
ID quick   ^\+628\d{8,11}$
ID strict  ^\+628[1-35-9]\d{7,10}$

# Philippines: mobiles
PH quick   ^\+639\d{9}$
PH strict  ^\+63(?:8(?:1[37]|9[5-8])|9(?:0[5-9]|1[0-24-9]|[235-7]\d|4[2-9]|8[135-9]|9[1-9]))\d{7}$

# Nigeria: mobiles
NG quick   ^\+234[789][01]\d{8}$
NG strict  ^\+234(?:702[0-24-9]\d{6}|819[01]\d{6}|(?:7(?:0[13-9]|[12]\d)|8(?:0[1-9]|1[0-8])|9(?:0[1-9]|1[0-6]))\d{7})$

# Pakistan: mobiles
PK quick   ^\+923\d{9}$
PK strict  ^\+923(?:[0-247]\d|3[0-79]|55|64)\d{7}$

# Mexico: geographic numbers
MX quick   ^\+52[2-9]\d{9}$

# Australia: mobiles
AU quick   ^\+614\d{8}$
AU strict  ^\+614(?:79[01]\d{5}|83[0-36-9]\d{5}|9(?:5[0-3]|6[0-4])\d{5}|(?:[0-36]\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\d{6})$
```

The Brazil strict pattern also accepts 10-digit numbers whose subscriber part starts with `7`, an older 8-digit range that libphonenumber still types as mobile. If you only want today's 9-digit mobiles, replace `(?:7|9\d)\d{7}` with `9\d{8}`.

## How often do the quick regexes get it wrong?

Here is what the 100,000 random strings per country showed against `phonenumbers` 9.0.43. "False accepts" is the share of the regex's matches that the library doesn't accept as a mobile number of that country (geographic number for the US, Canada and Mexico). "Misses" is the share of library-valid numbers the regex rejects.

| Country | Quick: false accepts | Quick: misses | Strict: disagreements | What the quick regex gets wrong |
|---|---|---|---|---|
| US (NANP) | 44.9% | 0 | no strict form | Unused area codes; toll-free, personal and VoIP ranges pass |
| Canada | 92.0% | 0 | 0 | Can't tell Canada from the US: most matches are US or Caribbean numbers |
| UK | 1.2% | 0 | 0 | 88 of 103 false accepts are Jersey, Guernsey or Isle of Man mobiles |
| India | 16.8% | 1 in 11,968 | no strict form | Every false accept was a landline (for example `079` Ahmedabad); misses the `1600` series |
| Germany | 26.1% | 0 | 0 | Accepts numbers one digit too short for their block |
| France | 9.8% | 0 | 0 | Unallocated `06` and `07` blocks |
| Brazil | 9.3% | 50.9% | 0 | Unused area codes; misses the older `7` range (heavy in our sample) |
| Indonesia | 20.4% | 0 | 0 | `084` and other unallocated blocks; some toll-free and premium ranges |
| Philippines | 12.3% | 0.6% | 0 | Unallocated `09` blocks; misses the `0813`, `0817` and `0895`–`0898` mobile blocks |
| Nigeria | 8.8% | 4.1% | 0 | `0800` toll-free and `0700` ranges pass; misses the whole `072` mobile block |
| Pakistan | 38.7% | 0 | 0 | Unallocated `03` blocks such as `035` |
| Mexico | 58.2% | 0 | no strict form | Unused area codes; toll-free and personal ranges pass |
| Australia | 9.3% | 0 | 0 | Unallocated `04` sub-blocks such as `0446` |

The rates depend on how we sampled, so read them as an order of magnitude, not a property of real traffic. The pattern holds, though. A short regex is loose in most countries and too tight in a few, and the strict patterns match the library exactly, for now.

## What do the regexes say about real example inputs?

These are the 39 named cases. The library columns show the region and type returned, or `invalid`. Numbers that aren't library examples, fiction-like digits or unallocated are masked with X.

| Country | Input | Case | Quick | Strict | phonenumbers 9.0.43 | libphonenumber-js 1.13.15 |
|---|---|---|---|---|---|---|
| US | `+12015550123` | Library example | match | – | US FIXED_LINE_OR_MOBILE | same |
| US | `+18002345678` | Toll-free example | match | – | US TOLL_FREE | same |
| US | `+12908087881` | Unused `290` area code | match | – | invalid | invalid |
| CA | `+15062345678` | Library example | match | match | CA FIXED_LINE_OR_MOBILE | same |
| CA | `+12015550123` | A US number | match | no match | US FIXED_LINE_OR_MOBILE | same |
| CA | `+12735550123` | New `273` area code, fictional `555-01XX` line | match | match | CA FIXED_LINE_OR_MOBILE | same |
| GB | `+447400123456` | Library example | match | match | GB MOBILE | same |
| GB | `+44750960XXXX` | Jersey mobile | match | no match | JE MOBILE | same |
| GB | `+441212345678` | Fixed-line example | no match | no match | GB FIXED_LINE | same |
| GB | `+447911533492` | Unallocated `07911 5` | match | no match | invalid | invalid |
| IN | `+918123456789` | Library example | match | – | IN MOBILE | same |
| IN | `+917923456789` | Ahmedabad landline shape (`079`) | match | – | IN FIXED_LINE | same |
| IN | `+91160055XXXX` | `1600` series | no match | – | IN MOBILE | same |
| DE | `+4915123456789` | Library example | match | match | DE MOBILE | same |
| DE | `+491512345678` | Example, one digit short | match | no match | invalid | invalid |
| DE | `+491541048XXXX` | New `015410` block | match | match | DE MOBILE | **invalid** |
| FR | `+33612345678` | Library example | match | match | FR MOBILE | same |
| FR | `+33696309707` | Unallocated `0696` | match | no match | invalid | invalid |
| BR | `+5511961234567` | Library example | match | match | BR MOBILE | same |
| BR | `+551123456789` | Fixed-line example | no match | no match | BR FIXED_LINE | same |
| BR | `+55117989XXXX` | Older `7` range | no match | match | BR MOBILE | same |
| ID | `+62812345678` | Library example | match | match | ID MOBILE | same |
| ID | `+628123456780` | Example plus one digit | match | match | ID MOBILE | same |
| ID | `+62842084898` | Unallocated `084` | match | no match | invalid | invalid |
| PH | `+639051234567` | Library example | match | match | PH MOBILE | same |
| PH | `+63817719XXXX` | `0817` mobile block | no match | match | PH MOBILE | same |
| PH | `+639827177673` | Unallocated `0982` | match | no match | invalid | invalid |
| NG | `+2348021234567` | Library example | match | match | NG MOBILE | same |
| NG | `+234714153XXXX` | `0714` mobile block | match | match | NG MOBILE | same |
| NG | `+234910740XXXX` | New `0910` block | match | match | NG MOBILE | same |
| PK | `+923012345678` | Library example | match | match | PK MOBILE | same |
| PK | `+923523846926` | Unallocated `035` | match | no match | invalid | invalid |
| MX | `+522221234567` | Library example | match | – | MX FIXED_LINE_OR_MOBILE | same |
| MX | `+528001234567` | Toll-free example | match | – | MX TOLL_FREE | same |
| MX | `+525486824253` | Unused `548` area code | match | – | invalid | invalid |
| AU | `+61412345678` | Library example | match | match | AU MOBILE | same |
| AU | `+61212345678` | Fixed-line example | no match | no match | AU FIXED_LINE | same |
| AU | `+6149621XXXX` | New `0496` block | match | match | AU MOBILE | **invalid** |
| AU | `+61446455590` | Unallocated `0446` | match | no match | invalid | invalid |

Two rows to remember. Indonesia's "one digit too many" is still a valid mobile, because Indonesian mobiles run from 9 to 12 national digits; length alone can't flag it. And the two bold cells are not regex bugs: they show the JavaScript library behind the newest metadata, which is the next problem.

The library examples are for offline tests only. libphonenumber's [FAQ](https://github.com/google/libphonenumber/blob/master/FAQ.md) warns that some of them "do connect to a real person", so never text or call one. For fixtures, use the reserved fictional ranges in our [test phone numbers by country](/blog/test-phone-numbers-by-country) guide.

## Why do copied regexes go stale?

Because numbering plans change all the time, and a copied pattern doesn't get the update. Google's [release notes](https://github.com/google/libphonenumber/blob/master/release_notes.txt) show four releases in six weeks:

| Release | Date | Changes that touch this post |
|---|---|---|
| 9.0.40 | 23 Sep 2026 | Canada metadata, new geocoding for area code `+1 273` |
| 9.0.41 | 7 Oct 2026 | Nigeria and US metadata (the new `0910` block) |
| 9.0.42 | 22 Oct 2026 | Australia and India metadata (the new `0496` sub-block) |
| 9.0.43 | 4 Nov 2026 | Germany metadata (the new `015410` block) |

We compared the 9.0.43 file with the metadata in Python `phonenumbers` 9.0.40. The mobile patterns of Australia, Germany, India, Nigeria and the US had all changed; the other eight countries in this post had not. A strict regex copied in September would already reject `0910` in Nigeria, `0496` in Australia and `015410` in Germany.

The JavaScript port lags in the same way. libphonenumber-js 1.13.15 (8 October 2026) carries metadata 9.0.41: on our random strings it disagreed with our strict patterns on 52 Australian and 2 German numbers, all in the new blocks. The 1.13.13 release, from 10 September, also rejected Canada's `273` area code, 79 times in our sample. Our research on [how often numbering plans change](/blog/numbering-plans-change-research-2026) tracks this across countries.

So a regex is a snapshot. If you keep one, pin the metadata version in a comment, add a test with a number from each new block, and re-check it when the library releases.

## How do I use these regexes in JavaScript, Python and PHP?

Normalize first, then match, then let the library decide. The three examples below ran on 2026-11-07; the output is pasted under each.

**JavaScript (Node.js 24, libphonenumber-js 1.13.15).** JavaScript's `\d` is ASCII-only and `$` doesn't match before a trailing newline, so the patterns work as written.

```js
import { parsePhoneNumberFromString } from "libphonenumber-js/max";

// Metadata-derived mobile patterns, applied to E.164 strings (libphonenumber 9.0.43, 2026-11-04)
const MOBILE = {
  FR: /^\+33(?:6(?:[0-24-8]\d|3[0-8]|9[589])|7[3-9]\d)\d{6}$/,
  PK: /^\+923(?:[0-247]\d|3[0-79]|55|64)\d{7}$/,
  AU: /^\+614(?:79[01]\d{5}|83[0-36-9]\d{5}|9(?:5[0-3]|6[0-4])\d{5}|(?:[0-36]\d|4[047-9]|[58][0-24-9]|7[02-8]|9[0-47-9])\d{6})$/,
};

function check(raw, country) {
  const p = parsePhoneNumberFromString(raw, country);   // handles spaces, 0 prefix, +, 00 where supported
  const e164 = p?.number ?? null;
  return { raw, e164, regex: e164 ? MOBILE[country].test(e164) : false, library: p ? `${p.isValid()} ${p.getType() ?? ""}`.trim() : "unparseable" };
}

for (const [raw, c] of [["06 12 34 56 78", "FR"], ["0301 2345678", "PK"], ["0352 3846926", "PK"], ["0491 570 006", "AU"]]) console.log(check(raw, c));
```

```text
{
  raw: '06 12 34 56 78',
  e164: '+33612345678',
  regex: true,
  library: 'true MOBILE'
}
{
  raw: '0301 2345678',
  e164: '+923012345678',
  regex: true,
  library: 'true MOBILE'
}
{
  raw: '0352 3846926',
  e164: '+923523846926',
  regex: false,
  library: 'false'
}
{
  raw: '0491 570 006',
  e164: '+61491570006',
  regex: true,
  library: 'true MOBILE'
}
```

`0491 570 006` is one of the ACMA's numbers reserved for fiction, so it is safe to use. Our [JavaScript validation guide](/blog/phone-number-validation-javascript) covers the parser in depth.

**Python (3.12, phonenumbers 9.0.43).** Here two defaults bite. Python's `\d` matches any Unicode decimal digit, so `^\+91[6-9]\d{9}$` matched `+9198765४३२१०`, with Devanagari digits, in our test. And `$` also matches before a trailing newline. The [Python `re` documentation](https://docs.python.org/3/library/re.html) describes both. Compile with `re.ASCII` and call `fullmatch`.

```python
import re
import phonenumbers

# re.ASCII: without it, \d also matches Devanagari, Arabic-Indic and other Unicode digits
MOBILE = {
    "IN": re.compile(r"\+91[6-9]\d{9}", re.ASCII),  # quick: also passes landlines
    "NG": re.compile(r"\+234(?:702[0-24-9]\d{6}|819[01]\d{6}|(?:7(?:0[13-9]|[12]\d)|8(?:0[1-9]|1[0-8])|9(?:0[1-9]|1[0-6]))\d{7})", re.ASCII),
}

def check(raw, country):
    try:
        p = phonenumbers.parse(raw, country)
    except phonenumbers.NumberParseException:
        return raw, None, False, "unparseable"
    e164 = phonenumbers.format_number(p, phonenumbers.PhoneNumberFormat.E164)
    regex = MOBILE[country].fullmatch(e164) is not None   # fullmatch, not match + $ (which allows a trailing newline)
    t = phonenumbers.number_type(p)
    return raw, e164, regex, f"{phonenumbers.is_valid_number(p)} {phonenumbers.PhoneNumberType.to_string(t)}"

for raw, c in [("081234 56789", "IN"), ("079 2345 6789", "IN"), ("0802 123 4567", "NG"), ("0919 522 9695", "NG")]:
    print(check(raw, c))
```

```text
('081234 56789', '+918123456789', True, 'True MOBILE')
('079 2345 6789', '+917923456789', True, 'True FIXED_LINE')
('0802 123 4567', '+2348021234567', True, 'True MOBILE')
('0919 522 9695', '+2349195229695', False, 'False UNKNOWN')
```

The second line is the Indian trap: the quick regex says "mobile" for a landline, and only the library's type catches it. Our [India validation post](/blog/india-mobile-number-validation) and [Python guide](/blog/phone-number-validation-python) go further.

**PHP (8.3.6, `preg_match`).** Without modifiers, PHP's `$` also matches before a final newline; the [`D` modifier](https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php) turns that off. Don't add `u` to these patterns: in our run on PHP 8.3.6 it made `\d` match the Devanagari digits too.

```php
<?php
// No /u flag (it makes \d match non-ASCII digits); D makes $ refuse a trailing "\n".
const MOBILE = [
    'DE' => '/^\+49(?:15(?:[0-25-9]\d\d|3(?:10|33)|410)\d{6}|1(?:6[023]|7\d)\d{7,8})$/D',
    'PH' => '/^\+63(?:8(?:1[37]|9[5-8])|9(?:0[5-9]|1[0-24-9]|[235-7]\d|4[2-9]|8[135-9]|9[1-9]))\d{7}$/D',
];

function looksMobile(string $e164, string $country): bool
{
    return preg_match(MOBILE[$country], $e164) === 1;
}

foreach ([['+4915123456789', 'DE'], ['+491512345678', 'DE'], ["+4915123456789\n", 'DE'], ['+639051234567', 'PH'], ['+639827177673', 'PH']] as [$n, $c]) {
    printf("%-18s %s %s\n", json_encode($n), $c, looksMobile($n, $c) ? 'match' : 'no match');
}
```

```text
"+4915123456789"   DE match
"+491512345678"    DE no match
"+4915123456789\n" DE no match
"+639051234567"    PH match
"+639827177673"    PH no match
```

Without `D`, the third input matched in our test. For parsing and validation in PHP, use a libphonenumber port, as in our [PHP and Laravel guide](/blog/phone-number-validation-php-laravel).

## When is a regex the right tool, and when isn't it?

A regex is fine for three jobs:

- **Typing feedback** in a form, before the user submits. Use the quick pattern and keep it loose; our [input field guide](/blog/phone-number-input-field-best-practices) explains why.
- **A storage invariant**, such as a database `CHECK` on the E.164 column, so no unnormalized value gets in.
- **Places where you can't run a library**, such as a SQL filter over an old table or a log search. Use the strict pattern and note its metadata version.

For anything that decides whether to accept, message or bill a number, use a maintained library and update it monthly. The libraries returned the right region and type for inputs a regex can't classify, such as the Indian landline and the Jersey mobile in the table above.

## What can't a regex or a library tell you?

Whether the number works today. Both check the numbering plan, not the network. A number in an allocated mobile block can be unassigned, switched off, recycled to a new owner, or ported to another network. libphonenumber's FAQ says so plainly: "Do not rely on libphonenumber to determine whether numbers are currently assigned to a specific user and reachable." Our post on [whether libphonenumber checks if a number is active](/blog/does-libphonenumber-check-if-a-number-is-active) shows the difference with examples.

| Question | Tool |
|---|---|
| Is the string in E.164 shape? | General regex, or a database constraint |
| Does it fit a country's allocated mobile blocks? | Strict regex (snapshot) or libphonenumber (maintained) |
| Is it a mobile, landline or VoIP line today, and on which network? | [Carrier lookup](/services/carrier-lookup) |
| Is the phone attached to the network right now? | Live network status ([HLR lookup](/services/hlr-lookup)) |

## How does MobileValidate check numbers after the regex?

Every number sent to our API is first normalized and validated with libphonenumber metadata. Numbers that fail come back as `invalid_number` and are never checked or billed. The paid checks then answer the questions a pattern can't: line type and carrier, live reachability, porting, and whether the number is registered on messaging apps. Check only numbers your users gave you, for a purpose they agreed to.

- **Free tools, no sign-up.** Paste a few numbers into the [phone number validator](/tools/phone-number-validator) to see the type and E.164 form, or clean and dedupe a whole file with the [phone list cleaner](/tools/phone-list-cleaner). Both run in your browser. The free [carrier lookup](/services/carrier-lookup) answers three numbers a day without an account.
- **Free to build.** [Get a free test key](/get-test-key) to build against fixed test answers ([test mode](/docs/test-mode)), and use the free estimate on any bulk file before you pay.
- **Real checks free.** Every live account can check 100 phone numbers and 20 e-mail addresses for real, free, on the dashboard's **Try it** page. [Request access](/request-access) to open one.
- **Bulk jobs.** Upload a CSV, see the estimate, then run carrier, [HLR](/services/hlr-lookup) or channel checks on the whole list. Inconclusive results (`unknown`, timeouts, invalid numbers, duplicates) are never charged; see [current prices](/pricing).
- **Prepay.** Top-ups of US$100 or more get a 5% bonus, US$500 or more 8%, and US$2,000 or more 10%.

## What are the key takeaways?

- Phone regexes only work per country, on E.164 strings. Normalize first.
- The short patterns tutorials give let through numbers the library rejects in 1.2% (UK) to 58.2% (Mexico) of matches in our test, and some miss real mobile blocks (Philippines `08`, Nigeria `072`, India `1600`).
- Strict patterns copied from libphonenumber 9.0.43 matched the library exactly for 10 countries, but they are snapshots: Australia, Germany and Nigeria added mobile blocks between September and November 2026.
- Even libphonenumber-js 1.13.15 lagged the newest metadata on 2026-11-07. Update libraries monthly and pin versions in tests.
- In Python use `re.ASCII` and `fullmatch`; in PHP use `D` and skip `u`.
- A valid number isn't a working one: line type, reachability and porting need a lookup.

Country guides with the full numbering plans: [US](/blog/us-phone-number-format), [India](/blog/india-phone-number-format), [Germany](/blog/germany-phone-number-format), [France](/blog/france-phone-number-format), [Indonesia](/blog/indonesia-phone-number-format), [Nigeria](/blog/nigeria-phone-number-format), [Pakistan](/blog/pakistan-phone-number-format), [Mexico](/blog/mexico-phone-number-format) and [Australia](/blog/australia-phone-number-format), or browse all [phone numbers by country](/blog/phone-numbers-by-country).

## Sources

1. [libphonenumber release notes](https://github.com/google/libphonenumber/blob/master/release_notes.txt) — Google, 2026
2. [PhoneNumberMetadata.xml (libphonenumber master, v9.0.43)](https://github.com/google/libphonenumber/blob/master/resources/PhoneNumberMetadata.xml) — Google, 2026
3. [libphonenumber FAQ](https://github.com/google/libphonenumber/blob/master/FAQ.md) — Google, 2026
4. [phonenumbers (Python port of libphonenumber), release 9.0.43](https://pypi.org/project/phonenumbers/) — Python Package Index, 2026
5. [re: Regular expression operations](https://docs.python.org/3/library/re.html) — Python Software Foundation, 2026
6. [PCRE pattern modifiers](https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php) — PHP Documentation Group, 2026

## Frequently asked questions

### What is the regex for a mobile number in a given country?

Normalize to E.164 first, then match a country pattern. Examples that matched libphonenumber 9.0.43 exactly in our test: France ^\+33(?:6(?:[0-24-8]\d|3[0-8]|9[589])|7[3-9]\d)\d{6}$ and Pakistan ^\+923(?:[0-247]\d|3[0-79]|55|64)\d{7}$. The short versions most tutorials give, such as ^\+923\d{9}$, also accept unallocated blocks.

### How accurate are the short phone regexes most tutorials give?

Not very. On 100,000 random strings per country, run on 2026-11-07, the short pattern let through numbers that libphonenumber rejects in 1.2% of matches for the UK, 26.1% for Germany, 38.7% for Pakistan, 44.9% for the US and 58.2% for Mexico. Some also missed real mobile ranges, such as the 08 blocks in the Philippines.

### Is there a regex that validates phone numbers for every country?

No. The general E.164 pattern ^\+[1-9]\d{1,14}$ only checks the shape: a plus and up to 15 digits. Which digits are allocated, and how long a number is, are set country by country and change several times a month. A numbering-plan library such as libphonenumber is the tool for that.

### Can I copy libphonenumber's patterns into my own regex?

You can, and for some countries the result is short. But the patterns go stale: between versions 9.0.40 (23 September 2026) and 9.0.43 (4 November 2026), the mobile patterns of Australia, Germany, Nigeria, India and the US all changed. A copied regex needs the same updates as the library, so keep it only where you can't run the library.

### How do I write a regex for a US phone number?

For a normalized E.164 string, ^\+1[2-9]\d{2}[2-9]\d{6}$ checks the North American shape. It can't tell the US from Canada or the Caribbean, and in our test 44.9% of the strings it matched were not valid geographic numbers, mostly because of unused area codes. Toll-free and personal-number ranges also pass.

### Why does my Python phone regex accept non-ASCII digits?

In Python, \d matches any Unicode decimal digit, including Devanagari and Arabic-Indic digits, and $ also matches before a trailing newline. Compile with re.ASCII and use fullmatch. In PHP, avoid the u modifier for these patterns and add D so $ refuses a trailing newline.

### Does a valid number mean the phone is in use?

No. A regex or a library tells you the number fits an allocated range. Whether it is assigned, switched on, a mobile today or ported to another network needs a lookup against the network, such as a carrier lookup or a live HLR query.
