Regex Tester & Builder

Test, debug, and learn regular expressions with real-time matching, explanations, and common patterns.

Pattern Configuration
Define your regular expression pattern and options
Input
//g

Find all matches

Case insensitive

^ and $ match line breaks

. matches newlines

Use $1, $2, etc. to reference capture groups in replacement

Test & Results
Enter test text and view matches in real-time
70 characters
Hello World! This is a test string with various words and numbers 123.

No matches found

Try adjusting your pattern or test string

Common Regex Patterns
Click any pattern to load it instantly with example text
Email Address
Validates email addresses with proper format
validation
/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
Example: user@example.com
Phone Number (US)
Matches US phone numbers in various formats
validation
/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/
Example: (555) 123-4567
URL/Website
Matches HTTP/HTTPS URLs and websites
validation
/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/
Example: https://www.example.com/path
IPv4 Address
Validates IPv4 addresses (0.0.0.0 to 255.255.255.255)
validation
/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
Example: 192.168.1.1
Strong Password
At least 8 chars with upper, lower, number, special character
validation
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/
Example: MyPass123!
Credit Card
Matches major credit card number formats
validation
/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|3[0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$/
Example: 4111111111111111
Date (YYYY-MM-DD)
Validates ISO date format
validation
/^\d{4}-\d{2}-\d{2}$/
Example: 2024-12-31
Time (24 Hour)
Validates 24-hour time format
validation
/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/
Example: 14:30 or 09:15
Social Security
Matches US Social Security Number format
validation
/^\d{3}-\d{2}-\d{4}$/
Example: 123-45-6789
Regex Reference Guide

Basic Metacharacters

  • .Any character
  • *Zero or more
  • +One or more
  • ?Zero or one
  • ^Start of string
  • $End of string

Character Classes

  • \dAny digit [0-9]
  • \wWord character
  • \sWhitespace
  • [abc]a, b, or c
  • [a-z]Lowercase range
  • [^abc]Not a, b, or c

Quantifiers

  • {3}Exactly 3
  • {3,}3 or more
  • {3,5}Between 3-5
  • *?Lazy zero or more
  • +?Lazy one or more
  • ??Lazy zero or one

Groups & Assertions

  • (abc)Capture group
  • (?:abc)Non-capture
  • \bWord boundary
  • (?=abc)Positive lookahead
  • (?!abc)Negative lookahead
  • a|ba OR b