T
ToolPrime

Regex for Phone Number (EU)

Validates common European phone number formats with optional country code, area code, and various separators.

Pattern

/^\+?[1-9][0-9]{0,3}[\s.-]?\(?[0-9]{1,5}\)?[\s.-]?[0-9]{1,5}[\s.-]?[0-9]{1,5}$/

Live Tester

Enter a string to test

Examples

+49 170 1234567
+44 20 7946 0958
49 30 12345678
+0 123 456
abc
++49 170

Pattern Breakdown

^\+?[1-9][0-9]{0,3} — optional + and 1-4 digit country code (no leading zero)

[\s.-]? — optional separator (space, dot, or hyphen)

\(?[0-9]{1,5}\)? — optional area code with optional parentheses

[\s.-]?[0-9]{1,5} — separator + subscriber digits (repeated)

Code Snippets

Javascript

const regex = /^\+?[1-9][0-9]{0,3}[\s.-]?\(?[0-9]{1,5}\)?[\s.-]?[0-9]{1,5}[\s.-]?[0-9]{1,5}$/;
regex.test("+49 170 1234567"); // true

Python

import re
pattern = r"^\+?[1-9][0-9]{0,3}[\s.-]?\(?[0-9]{1,5}\)?[\s.-]?[0-9]{1,5}[\s.-]?[0-9]{1,5}$"
bool(re.match(pattern, "+49 170 1234567"))  # True

Php

$pattern = '/^\+?[1-9][0-9]{0,3}[\s.-]?\(?[0-9]{1,5}\)?[\s.-]?[0-9]{1,5}[\s.-]?[0-9]{1,5}$/';
preg_match($pattern, "+49 170 1234567"); // 1

Related Patterns