~/devtools / regex / phone
tool::regex-guide

regex phone

/^\+?[\d\s\-\(\)]{7,15}$/

Phone Number Validation

ad · 728×90
Regex Pattern
/^\+?[\d\s\-\(\)]{7,15}$/
Flags:none
Pattern Breakdown
^Start of string
\+?Optional leading + (international prefix)
[\d\s\-\(\)]Digit, space, dash, or parenthesis
{7,15}Between 7 and 15 characters total
$End of string
Matching Examples
✓+1 800 555 0100
✓0800-555-0100
✓(555) 123-4567
✓07911123456
Non-Matching Examples
✗abc-def-ghij
✗123
✗++1234567890
✗1234567890123456

Validates phone numbers in various international formats. Allows common separators like +country code, spaces, hyphens, and parentheses. The 7–15 character length constraint covers the E.164 standard range.

Language Usage

JavaScript— Use RegExp object or literal syntax
const pattern = /^\+?[\d\s\-\(\)]{7,15}$/;

// Test a string
console.log(pattern.test("+1 800 555 0100")); // true
console.log(pattern.test("abc-def-ghij")); // false

// Match and extract
const result = "+1 800 555 0100".match(pattern);
Python— Use the re module
import re

pattern = r"^\+?[\d\s\-\(\)]{7,15}$"

# Test a string
if re.fullmatch(pattern, "+1 800 555 0100"):
    print("Valid")

# Find all matches in text
matches = re.findall(pattern, text)
Java— Use java.util.regex package
import java.util.regex.*;

String pattern = "^\\+?[\\d\\s\\-\\(\\)]{7,15}$";
Pattern p = Pattern.compile(pattern);

Matcher m = p.matcher("+1 800 555 0100");
boolean isValid = m.matches(); // true

// Find occurrences
Matcher finder = p.matcher(inputText);
while (finder.find()) {
    System.out.println(finder.group());
}

Common Use Cases

  • ▸Validate phone number inputs on registration forms
  • ▸Clean contact data in CRM systems
  • ▸Verify number format before sending SMS
  • ▸Handle multi-country phone numbers in global services
  • ▸Validate contact fields in order forms

Related Patterns

email/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-…/i→url/^https?:\/\/[^\s\/$.?#].[^\s]*$/i→ip-address/^((25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.…/→date/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[…/→
ad · 300×250
← Back to Regex Tester
// related tools
⏱
Cron Expression Generator
Build and parse cron expressions visually. Generate human-readable descriptions and preview next execution times.
jwt
JWT Decoder
Decode and inspect JWT tokens. View header, payload, and signature details.
◑
Color Converter
Convert colors between HEX, RGB, HSL, and more. Pick colors visually.
ts
Timestamp Converter
Convert Unix timestamps to human-readable dates. Supports ms/s, UTC/local, and relative time.