Loading...

Regex Tester

Test and debug regular expressions with real-time pattern matching, detailed results, and advanced developer features

Regular Expression Pattern

Create and test your regex patterns with real-time validation

//g

Test String

0 chars
Characters: 0
Lines: 1
Words: 0

Match Results

0
Total Matches
0
Pattern Length
1
Active Flags

Common Regex Patterns

Ready-to-use patterns for common validation tasks

📧

Email Address

Matches email addresses

Pattern
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Example Match
john.doe@example.com
🌐

URL

Matches HTTP/HTTPS URLs

Pattern
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
Example Match
https://www.example.com
📞

Phone Number (US)

Matches US phone numbers

Pattern
\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})
Example Match
(555) 123-4567
🌍

IP Address

Matches IPv4 addresses

Pattern
\b(?:(?: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]?)\b
Example Match
192.168.1.1
📅

Date (MM/DD/YYYY)

Matches dates in MM/DD/YYYY format

Pattern
\b(0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])[\/\-](19|20)\d\d\b
Example Match
12/25/2023
🎨

Hex Color

Matches hex color codes

Pattern
#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})
Example Match
#FF5733
💳

Credit Card

Matches credit card numbers

Pattern
\b(?:\d{4}[-\s]?){3}\d{4}\b
Example Match
4532 1234 5678 9012
👤

Username

Matches usernames (3-16 chars, alphanumeric + underscore)

Pattern
^[a-zA-Z0-9_]{3,16}$
Example Match
john_doe123

About Regular Expressions

Regular expressions (regex) are powerful patterns used for matching character combinations in strings. They're essential for text processing, validation, searching, and data extraction across all programming languages.

Basic Patterns

.Matches any character
\dMatches any digit (0-9)
\wMatches word characters
\sMatches whitespace

Quantifiers

*0 or more times
+1 or more times
?0 or 1 time (optional)
{n}Exactly n times

Anchors

^Start of string/line
$End of string/line
\bWord boundary
\BNon-word boundary

Pro Tips for Regex Testing

Best Practices:
  • • Start simple and build complexity gradually
  • • Test with multiple example inputs
  • • Use capturing groups for data extraction
  • • Consider performance with large texts
Common Use Cases:
  • • Form validation (email, phone, etc.)
  • • Text parsing and data extraction
  • • Search and replace operations
  • • Log file analysis and filtering