I'd go with

# countryCode
(?:\+\d{1,3}|0\d{1,3}|00\d{1,2})

# actual number
(?:[-\/\s.]|\d)+

# combined with optional country code and parantheses in between
 ^(?:\+\d{1,3}|0\d{1,3}|00\d{1,2})?(?:\s?\(\d+\))?(?:[-\/\s.]|\d)+$

This should be good enough to match most most European and US representations of a phone Number as

+49 123 999
0001 123.456
+31 (0) 8123

But in general there are too many overlapping textual representation of a phone Number as to use a single Regex for different countries. If you could match all representations you'll get to many false positives. As what may be a number in Switzerland may be something else in Russia, Germany or Ghana. It's all about balancing precision and recall and optimizing the Regex to the countries you really need.

Answer from Andreas Neumann on Stack Overflow
Discussions

regex - Regular expression to match standard 10 digit phone number - Stack Overflow
Help yourself, use libphonenumber (or a fork in your language) ... If you are trying to do this, you are probably doing it wrong. Phone numbers are of varying lengths, include different country codes and in general are wierder than you think. Python and Java both have libraries that will parse phone numbers contextually and you should be using those kind of tools instead of trying to get a regex ... More on stackoverflow.com
🌐 stackoverflow.com
help with regex validation for worldwide email, phone numbers and address
Create a short answer question for the phone number. Click on the three dots (⋮) at the bottom right of the question field and select "Response validation." In the dropdown that appears, select "Regular expression." Choose "Matches" from the next dropdown. Paste the regex pattern into the text field. Add a custom error message if desired, such as "Please enter a valid phone number starting with a + followed by the country code and number." ^\+([0-9]{1,4})[-\s]?([0-9]{1,15})$ This regex should cover a wide range of international phone numbers, but keep in mind that certain country-specific formatting might not be fully captured due to the flexibility required for worldwide usage. If you encounter any specific cases where the regex fails, you may need to adjust the pattern slightly. More on reddit.com
🌐 r/GoogleForms
3
2
July 31, 2024
Phone validation regex - Stack Overflow
It's works for 0771234567 and ... to works for 077-1234567 and +077-1234567 and +077-1-23-45-67 and +077-123-45-6-7 ... If you are trying to do this, you are probably doing it wrong. Phone numbers are of varying lengths, include different country codes and in general are wierder than you think. Python and Java both have libraries that will parse phone numbers contextually and you should be using those kind of tools instead of trying to get a regex to do the ... More on stackoverflow.com
🌐 stackoverflow.com
Regex - simple phone number - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... I know there are a ton of regex examples on how to match certain phone number types. For my example I just want to allow numbers and a few special characters. More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
gist.github.com › jacurtis › ccb9ad32664d3b894c12
Most Useful Regex's · GitHub
Like everything in America, we are probably trying to be the most different from any other country. A formal format is (801) 123-4567 and this regex will verify those. It will also verify other formats such as 801-123-4567 or 801.123.4567.
Top answer
1 of 16
408
^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$

Matches the following

123-456-7890
(123) 456-7890
123 456 7890
123.456.7890
+91 (123) 456-7890

If you do not want a match on non-US numbers use

^(\+0?1\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$

Update :
As noticed by user Simon Weaver below, if you are also interested in matching on unformatted numbers just make the separator character class optional as [\s.-]?

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

https://regex101.com/r/j48BZs/2

2 of 16
247

There are many variations possible for this problem. Here is a regular expression similar to an answer I previously placed on SO.

^\s*(?:\+?(\d{1,3}))?[-. (]*(\d{3})[-. )]*(\d{3})[-. ]*(\d{4})(?: *x(\d+))?\s*$

It would match the following examples and much more:

18005551234
1 800 555 1234
+1 800 555-1234
+86 800 555 1234
1-800-555-1234
1 (800) 555-1234
(800)555-1234
(800) 555-1234
(800)5551234
800-555-1234
800.555.1234
800 555 1234x5678
8005551234 x5678
1    800    555-1234
1----800----555-1234

Regardless of the way the phone number is entered, the capture groups can be used to breakdown the phone number so you can process it in your code.

  • Group1: Country Code (ex: 1 or 86)
  • Group2: Area Code (ex: 800)
  • Group3: Exchange (ex: 555)
  • Group4: Subscriber Number (ex: 1234)
  • Group5: Extension (ex: 5678)

Here is a breakdown of the expression if you're interested:

^\s*                #Line start, match any whitespaces at the beginning if any.
(?:\+?(\d{1,3}))?   #GROUP 1: The country code. Optional.
[-. (]*             #Allow certain non numeric characters that may appear between the Country Code and the Area Code.
(\d{3})             #GROUP 2: The Area Code. Required.
[-. )]*             #Allow certain non numeric characters that may appear between the Area Code and the Exchange number.
(\d{3})             #GROUP 3: The Exchange number. Required.
[-. ]*              #Allow certain non numeric characters that may appear between the Exchange number and the Subscriber number.
(\d{4})             #Group 4: The Subscriber Number. Required.
(?: *x(\d+))?       #Group 5: The Extension number. Optional.
\s*$                #Match any ending whitespaces if any and the end of string.

To make the Area Code optional, just add a question mark after the (\d{3}) for the area code.

🌐
UI Bakery
uibakery.io › regex-library › phone-number
Phone number regex
This regular expression will match phone numbers entered with delimiters (spaces, dots, brackets, etc.) /^\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}$/ ... var regex = /^\+?\d{1,4}?[-.\s]?\(?\d{1,3}?\)?[-.\s]?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}$/; regex.test('+1 (615) 243-5172'); // returns true
🌐
RegExr
regexr.com › 3c53v
Phone Number regex
Supports JavaScript & PHP/PCRE RegEx. Results update in real-time as you type. Roll over a match or expression for details.
🌐
Reddit
reddit.com › r/googleforms › help with regex validation for worldwide email, phone numbers and address
r/GoogleForms on Reddit: help with regex validation for worldwide email, phone numbers and address
July 31, 2024 -

Hello, posting here in case someone can help. I need to add some sort of data validation in google forms for international phone numbers, the rules I have are:

The numbers should start with a plus sign ( + )
It should be followed by Country code and National number 1 to 4 digits between 0 and 9
It may contain white spaces or a hyphen ( – ).
the length of phone numbers may vary from 7 digits to 15 digits.

The form is going to be available to people that are based worldwide so it needs to be flexible enough to cover most countries. I've searched online extensively as this is quite common but my phone numbers keep getting errors, anyone has one that works? Thank you

Find elsewhere
🌐
O'Reilly
oreilly.com › library › view › regular-expressions-cookbook › 9781449327453 › ch04s02.html
4.2. Validate and Format North American Phone Numbers - Regular Expressions Cookbook, 2nd Edition [Book]
August 27, 2012 - If the phone number is valid, you want to convert it to your standard format, (123) 456-7890, so that your phone number records are consistent.
Authors   Jan GoyvaertsSteven Levithan
Published   2012
Pages   609
🌐
Regex Pattern
regexpattern.com › home › phone number regular expressions
Phone Number Regular Expressions - Regex Pattern
March 29, 2022 - A collection of useful Regular Expressions to parse, validate, and format phone numbers around the world. For many of us, knowing how to work with regular expressions is a huge time saver. Regular expressions are powerful but can be easy to misuse or even get wrong. If you aren’t careful when building regex patterns, you can waste a lot of time tracking down hard-to-find bugs.
🌐
Trestle
trestleiq.com › home › product › phone validation regex: the what, how, and pros and cons
Phone Validation Regex: The What, How, and Pros and Cons
September 24, 2025 - Regex is flexible, and you can provide guidelines in a pattern that fits the type of formatting you’d like to validate. As an example, take a look at the below phone regex pattern: ... This regex pattern would allow a phone number field to be populated with any 9-digit phone number from any country code 1-3 digits long.
🌐
regex101
regex101.com › library › wZ4uU6
regex101: Regex for telephone numbers all over the world
Number Length: The phone number must have exactly 8 digits following the operator code, for a total of 11 digits (including the country code and operator code). This regex is commonly used to ensure that the input phone numbers follow the standard Egyptian format and belong to the correct mobile operators.Submitted by Mohamed Amir
🌐
Medium
medium.com › @davidlindercodes › the-ultimate-regex-for-verifying-uk-phone-numbers-fd99db881753
The Ultimate REGEX for verifying UK phone numbers | by David Linder | Medium
December 28, 2022 - I wrote a little regex code for optional empty spaces (0, 1 or multiple): ... and then I simply added that to the end of the regex query. I also added to the start of the query also. So the phone number can start with empty spaces also.
Top answer
1 of 16
42

Please refer to this SO Post

example of a regular expression in jquery for phone numbers

/\(?([0-9]{3})\)?([ .-]?)([0-9]{3})\2([0-9]{4})/
  • (123) 456 7899
  • (123).456.7899
  • (123)-456-7899
  • 123-456-7899
  • 123 456 7899
  • 1234567899

are supported

2 of 16
28

This solution actually validates the numbers and the format. For example: 123-456-7890 is a valid format but is NOT a valid US number and this answer bears that out where others here do not.


If you do not want the extension capability remove the following including the parenthesis: (?:\s*(?:#|x.?|ext.?|extension)\s*(\d+)\s*)? :)

edit (addendum) I needed this in a client side only application so I converted it. Here it is for the javascript folks:

var myPhoneRegex = /(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]‌​)\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)([2-9]1[02-9]‌​|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})\s*(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+)\s*)?$/i;
if (myPhoneRegex.test(phoneVar)) {
    // Successful match
} else {
    // Match attempt failed
}

hth. end edit

This allows extensions or not and works with .NET

(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]‌​)\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)([2-9]1[02-9]‌​|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$

To validate with or without trailing spaces. Perhaps when using .NET validators and trimming server side use this slightly different regex:

(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]‌​)\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)([2-9]1[02-9]‌​|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})\s*(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+)\s*)?$

All valid:

1 800 5551212

800 555 1212

8005551212

18005551212

+1800 555 1212 extension65432

800 5551212 ext3333

Invalid #s

234-911-5678

314-159-2653

123-234-5678


EDIT: Based on Felipe's comment I have updated this for international.

Based on what I could find out from here and here regarding valid global numbers

This is tested as a first line of defense of course. An overarching element of the international number is that it is no longer than 15 characters. I did not write a replace for all the non digits and sum the result. It should be done for completeness. Also, you may notice that I have not combined the North America regex with this one. The reason is that this international regex will match North American numbers, however, it will also accept known invalid # such as +1 234-911-5678. For more accurate results you should separate them as well.

Pauses and other dialing instruments are not mentioned and therefore invalid per E.164

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

With 1-10 letter word for extension and 1-6 digit extension:

\(?\+[0-9]{1,3}\)? ?-?[0-9]{1,3} ?-?[0-9]{3,5} ?-?[0-9]{4}( ?-?[0-9]{3})? ?(\w{1,10}\s?\d{1,6})?

Valid International: Country name for ref its not a match.

+55 11 99999-5555 Brazil

+593 7 282-3889 Ecuador

(+44) 0848 9123 456 UK

+1 284 852 5500 BVI

+1 345 9490088 Grand Cayman

+32 2 702-9200 Belgium

+65 6511 9266 Asia Pacific

+86 21 2230 1000 Shanghai

+9124 4723300 India

+821012345678 South Korea

And for your extension pleasure

+55 11 99999-5555 ramal 123 Brazil

+55 11 99999-5555 foo786544 Brazil

Enjoy

🌐
AbstractAPI
abstractapi.com › api guides, tips & tricks › 5 ways to validate phone numbers with regex
5 Ways to Validate Phone Numbers Using Regex
August 8, 2025 - Validating phone numbers with regular expressions is a common first step in ensuring data quality for user-facing applications. We will explore five ways to implement this validation using regex, complete with working code snippets.
🌐
AbstractAPI
abstractapi.com › api guides, tips & tricks › mastering phone number regex for efficient validation
Mastering Phone Number Regex for Efficient Validation
June 7, 2024 - Finally, we have the capture group that matches the final 4 digits in the phone number, plus any included whitespace, and separators like dashes or periods: ... This capture group contains 6 subsequences, with 2 of those subsequences containing 3 smaller subsequences. ... This is a character set. It tells regex to match any character in the set. It contains 3 subsequences of escaped characters: ... It’s a pretty comprehensive pattern that accounts for a large percentage of possible phone numbers - however, it’s not perfect (no regex pattern is.)
🌐
Formulas HQ
formulashq.com › the-ultimate-guide-to-using-regex-for-phone-numbers
The Ultimate Guide to Using Regex for Phone Numbers - FormulasHQ
July 2, 2024 - Regex provides a robust solution for handling phone numbers with ease and efficiency. Understanding the basics of regex, the anatomy of a phone number, and mastering advanced techniques will empower you to effectively validate, extract, and manipulate phone numbers in your applications. However, it’s essential to be aware of the limitations and pitfalls that come with using regex. By considering these factors and following best ...
🌐
Baeldung
baeldung.com › home › java › validate phone numbers with java regex
Validate Phone Numbers With Java Regex | Baeldung
January 8, 2024 - This pattern will allow numbers like 2055550125, 202 555 0125, 202.555.0125, and 202-555-0125. Next, let’s add the possibility to have the first part of our phone between parentheses:
🌐
Abareplace
abareplace.com › blog › phone_numbers
Regex for phone numbers — Aba Search & Replace
Taking these restrictions into account, we can put together this regular expression to match a 10-digit US phone number: ^[ \t]*\(?(?!988)[2-9](?!11)\d\d\)?[ .-]?\d{3}[ .-]?\d{4}[ \t]*$ We use a negative lookahead here to skip the N11 codes and 988, so this regex is a bit more fool-proof than ...
🌐
Techgrind
techgrind.io › explain › how-to-validate-phone-numbers-using-regex
How to validate phone numbers using regex? - Techgrind.io
They parse and normalize phone numbers for you. ... In many cases, you only need to store digits and possibly a country code. You can strip out non-digit characters and then do simpler numeric checks (e.g., “must be 10 digits if local, up to 15 if international”). ... If you just want a phone number to “look okay,” a simple pattern is enough.