0

Phone Number Regex — Test Against Real Formats

Debug JavaScript regular expressions live: highlighted matches, capture groups, flags, and replacement preview.

Supports $1, $2 and named references like $<name>; $& inserts the whole match. Leave empty to hide the preview.

Processing... 0%

Result

This page preloads a tolerant phone number pattern: (?:\+\d{1,3}[\s.-]?)?\(?\d{2,4}\)?[\s.-]?\d{2,4}[\s.-]?\d{2,4}(?:[\s.-]?\d{2,4})?. It accepts an optional + and country code, an area code that may sit in brackets, and digit groups separated by spaces, dots or dashes — the formats people actually type, from +1 415 555 0132 to (044) 123-45-67.

Phone numbers are messier than emails: the same number can be written a dozen ways, so the pattern leans on optional separators ([\s.-]?) rather than one rigid layout. That tolerance has a price — short digit runs can slip through — which is why the sample includes negative examples. Watch the highlights to check where the boundary between "phone-like" and noise falls for your data.

Adapt it to your country in seconds: fix the country code by replacing \+\d{1,3} with a literal like \+380, or force exactly ten digits by removing the optional tail group. Every edit re-tests instantly against the sample, and the match counter tells you when you have gone too strict or too loose.