← Back to Programming Tools

🔍 Regex Tester

Test regular expressions with real-time matching across JS, PHP/PCRE, and Python flavors

Pattern & Flags

Results

Enter a pattern and test string to see matches...

📚 Pattern Library

Phone Number (US)

\d{3}-\d{3}-\d{4}

Matches: 555-123-4567

Email Address

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

Matches: user@example.com

URL

https?://[^\s]+

Matches: https://example.com

IP Address

\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b

Matches: 192.168.1.1

Hex Color

#[0-9A-Fa-f]{6}

Matches: #FF5733

Date (YYYY-MM-DD)

^\d{4}-\d{2}-\d{2}$

Matches: 2025-10-29

📖 Regex Cheat Sheet

Character Classes

\dDigit (0-9)
\wWord character
\sWhitespace
.Any character

Quantifiers

*0 or more
+1 or more
?0 or 1
{n,m}Between n and m

Anchors

^Start of string
$End of string
\bWord boundary

Groups

()Capture group
(?:)Non-capture group
|Alternation (OR)

📖 How to Use Regex Tester

Test and debug your regular expressions in real-time. Perfect for developers validating patterns for form validation, data extraction, or text processing:

1 Enter Your Regex Pattern

Type your regular expression in the pattern field. Use common patterns or click Quick Patterns for email, URL, phone, and date validation templates.

2 Add Test Text

Paste or type the text you want to match against your pattern. Real-time highlighting shows matches instantly as you type.

3 Set Flags and Options

Enable global (g), multiline (m), case-insensitive (i), or other flags. View capture groups, match positions, and detailed explanations.

4 Test and Debug

See live match count and highlighted results. Use the Regex Cheat Sheet for syntax reference. Export working patterns for your code.

❓ Frequently Asked Questions

Use global (g) to find all matches instead of stopping at the first. Case-insensitive (i) ignores upper/lower case. Multiline (m) treats ^ and $ as matching line starts/ends. Combine flags like /pattern/gi for global case-insensitive matching.
Use Quick Patterns to insert an email regex, then test with various email formats. Remember that perfect email validation is complex - use reasonable patterns that catch common errors while allowing valid formats.
Capture groups use parentheses ( ) to extract specific parts of a match. For example, (\d{3})-(\d{3})-(\d{4}) captures area code, prefix, and line number separately. Our tool displays all captured groups with their values.
Escape special regex characters with a backslash: \. for literal dot, \* for asterisk, \+ for plus, etc. Characters like . * + ? [ ] { } ( ) ^ $ | \ have special meaning and must be escaped to match literally.
Yes! Export your tested patterns with the Export button. Patterns are provided in JavaScript, Python, and general regex syntax so you can copy directly into your code.