Skip to content

Instantly share code, notes, and snippets.

@undone37
Last active October 28, 2021 11:58
Show Gist options
  • Save undone37/df287c5841ad6ca26b30b15b2651e394 to your computer and use it in GitHub Desktop.
Save undone37/df287c5841ad6ca26b30b15b2651e394 to your computer and use it in GitHub Desktop.
Regex for international phone number in specific format

Regex for international phone number in specific format

This is a regex for the special format of a phone number like this:

+[COUNTRY CODE] ([AREA CODE]) [CONNECTION NUMBER][[-[EXTENSION]]]

\+\d{1,3}\s\(\d{2,}\)\s\d{3,}(-\d{1,4})?$

It matches numbers like these:

+49 (30) 227-0
+49 (30) 2270
+49 (170) 1212121
+49 (25715) 777777-102
+1 (206) 555-0100
+44 (113) 496-0000
+44 (20) 7946-0000

Visit regexr.com/68edv to test your own.

@horobetzs
Copy link

Changed my life!

@undone37
Copy link
Author

Changed my life!

Hope it changed to a better life!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment