Regex to Match an E.164 Phone Number
Copy the pattern, paste your text below, and find every E.164 phone number. Below the tester: what the E.164 rules are and why formatting characters are not allowed.
What this pattern matches
This expression matches a phone number in E.164 format — the international standard used by APIs like Twilio: a leading +, a country code, and the subscriber number, up to 15 digits in total.
How it works, part by part
\+ — the literal plus sign that begins every E.164 number.
[1-9] — the first digit of the country code, which is never zero.
\d{1,14} — the remaining digits, bringing the maximum to 15.
Why no spaces or dashes
E.164 is the canonical storage format: pure digits with a plus, no spaces, brackets, or hyphens. Human-friendly formatting is added only for display. Strip separators from user input before matching, or use a library like libphonenumber to normalise numbers to E.164 first.
Use it in your code
import re
text = "Call +14155552671 or +442071838750. Local 020 7183 8750 is not E.164."
pattern = r'''\+[1-9]\d{1,14}'''
for m in re.finditer(pattern, text):
print(m.group())
const text = "Call +14155552671 or +442071838750. Local 020 7183 8750 is not E.164.";
const re = new RegExp(String.raw`\+[1-9]\d{1,14}`, "g");
console.log(text.match(re));
FAQ
Does it allow spaces or dashes?
No. E.164 is plus and digits only. Remove separators from the input before testing, or match a display format separately.
Does it check that the country code is real?
No. It only enforces the shape. Use libphonenumber to validate the country code and length per country.
What is the maximum length?
Fifteen digits after the plus. The pattern allows a first digit plus up to fourteen more.