Useful Regex Showcase – Match a phone number

Here’s how to match a prefix code (a + or (00), then a number from 1 to 1939, with an optional space):
This doesn’t look for a valid prefix but something that might be a prefix. See the full list of prefixes


Then, as the entire phone number length is, at most, 15, we can look for up to 14 digits:
At least 1 digit is spent for the prefix


The numbers may contains spaces, dots, or dashes and may be grouped by 2 or 3.

(?:[ .-][0-9]{3}){1,5}

With the optional prefix:

(?:(?:00|\+)?[0-9]{4})?(?:[ .-][0-9]{3}){1,5}

If you want to match a specific country format, you can use this search query and add the country, the question has certainly already been asked.

if you want to reproduce, please indicate the source:
Useful Regex Showcase – Match a phone number - CodeDay