Inside character class every character is matched literally, which means [(00)|(+)] will match a 0 or + or | or ( or )

Use this regex:

 String PHONE_PATTERN = "^(?:00|\\+)[0-9\\s.\\/-]{6,20}$";
Answer from anubhava on Stack Overflow
🌐
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. Validate patterns with suites of Tests.
🌐
UI Bakery
uibakery.io › regex-library › phone-number
Phone number regex
Most important things to know about Phone number regex and examples of validation and extraction of Phone number from a given string in JavaScript programming language.
Discussions

regex - Regular expression to match standard 10 digit phone number - Stack Overflow
Amitesh: it would be useful to ... for visitors to experiment with. 2020-04-13T06:36:31.013Z+00:00 ... @unnknown here is a link that produces an image similar to the one in this post. Amitesh's regex string has been already pasted in. You can enter phone numbers to test its ... 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
Regex : Phone number starting with 06 or 07
I have this function which works only for 10 digits. function telValide( tel ) { var reg = new RegExp('^[0-9]{10}$', 'i'); return reg.test(tel); } I would like to check phone number starting with 06 or 07. More on stackoverflow.com
🌐 stackoverflow.com
Regex to match invalid US phone numbers
You can put everything in a negative lookahead. https://regex101.com/r/bJ5ZKk/1 More on reddit.com
🌐 r/regex
2
5
March 29, 2022
🌐
regex101
regex101.com › library › wZ4uU6
regex101: Regex for telephone numbers all over the world
This regex include: Cellphone number: Viettel, Vinaphone, Mobiphone, Vietnamobile, Iteltelecom, Reddi (055) Telephone number (such as: 024, 028,...) Start with 0 or 84 Exactly 10 or 11 numbersSubmitted by tuangt12
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.

🌐
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
🌐
Regex Pattern
regexpattern.com › home › phone number regular expressions
Phone Number Regular Expressions - Regex Pattern
March 29, 2022 - That’s why I created this handy collection of regexes that are great for phone numbers. ... A regular expression to format and validate UK Phone Numbers, which should contain 11 digits and are normally in the format (01234) 123123.
🌐
RegexOne
regexone.com › problem › matching_phone_numbers
RegexOne - Learn Regular Expressions - Problem 2: Matching phone numbers
Having phone numbers from out of the state which require an area code, or international numbers which require a prefix will add complexity to the regular expression, as does the individual preferences that people have for entering phone numbers (some put dashes or whitespace while others do not for example). Below are a few phone numbers that you might encounter when using real data, write a single regular expressions that matches the number and captures the proper area code. ... Solve the above task to continue on to the next problem, or read the Solution. Next – Problem 3: Matching emails Previous – Problem 1: Matching a decimal numbers · Find RegexOne useful?
🌐
Indepth JavaScript
indepthjavascript.dev › how-to-match-a-phone-number-with-regex-and-javascript
Match a Phone Number with Regex and JavaScript
July 27, 2022 - If you want the phone number to start with 1 we add ^1 to the beginning of the string match, correct? Now we want to optionally add a dash or space after the 1. Luckily, we already know how to do that: `[ -]?'. ... Can you sense there's something ...
🌐
Akto
akto.io › tools › phone-number-regex-go-tester
Phone Number Regex Go Validator & Tester
Akto is the world’s best MCP and AI agent Security solution with powerful Discovery, Red Teaming, guardrails and Runtime Protection capabilities. It is the Gartner™ recognized vendor for Agentic Security.
🌐
GitHub
gist.github.com › jengle-dev › a327f2b58e08f384ec41dbb5e5454c28
RegEx Phone Number Matching & Validation · GitHub
This phone number RegEx does not have or use any flags. Flags are used to modify the behavior of the pattern. You can make the pattern include whitespace by using x or verbose. Here is a list of common flags but they do not make sense for use with phone numbers. i (ignore case): makes the pattern match case-insensitively · m (multiline): makes the ^ and $ anchors match the start ...
🌐
ActivityInfo
activityinfo.org › support › docs › forms › validating-phone-numbers-with-regular-expressions.html
Validating phone numbers with regular expressions
Let's start by matching the Vodacom numbers. Each Vodacom mobile number starts with "81" or "82" and another digit, and then two groups of three digits: REGEXMATCH(PHONE_NUMBER, "8[12][0-9] [0-9][0-9][0-9] [0-9][0-9][0-9]")
🌐
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 - A regular expression can easily check whether a user entered something that looks like a valid phone number. By using capturing groups to remember each set of digits, the same regular expression can be used to replace the subject text with precisely the format you want. ^\(?([0-9]{3})\)?[-.●]?([0-9]{3})[-.●]?([0-9]{4})$ ... Regex phoneRegex = new Regex(@"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$"); if (phoneRegex.IsMatch(subjectString)) { string formattedPhoneNumber = phoneRegex.Replace(subjectString, "($1) $2-$3"); } else { // Invalid phone number }
Authors   Jan GoyvaertsSteven Levithan
Published   2012
Pages   609
🌐
Baeldung
baeldung.com › home › java › validate phone numbers with java regex
Validate Phone Numbers With Java Regex | Baeldung
January 8, 2024 - This expression will allow numbers like (202)5550125, (202) 555-0125 or (202)-555-0125. Additionally, this expression will also allow the phone numbers covered in the previous example. Finally, let’s see how to allow an international prefix at the start of a phone number:
🌐
Avaya
documentation.avaya.com › bundle › IPOfficeMSTeamsDirectRouting › page › Telephone_Number_Examples.html
Regex Telephone Number Examples
Skip to main contentSkip to search · Powered by Zoomin Software. For more details please contactZoomin · Log in to get a better experience · Login · Stay Connected · SitemapTerms of UsePrivacyCookiesTrademarksAccessibility
🌐
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 - These are just a few basic patterns to get you started. In the next section, we will explore more advanced techniques to handle variations in phone number formats. Phone numbers can have a wide range of formats, including different separators (e.g., hyphens, spaces) and variable lengths for different components. Regex allows you to handle these variations efficiently by using character classes and optional patterns. For example, to match phone numbers with ...
🌐
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 - While regex patterns can become complex to develop and implement for specific validation types, they are typically very reliable. Additionally, they can be implemented in several different programming languages, such as Javascript, Python, and Java. In Python, you can use the “re” module to work with regular expressions. Here’s how you might use it to check if a string matches the specified phone number format: