About Regex Tester
Write a regex pattern, paste some test text, and see matches highlighted instantly. The tester shows capture groups, match counts, and helps you debug patterns before using them in code.
Regular expressions look like cryptic symbols but they're incredibly powerful for text processing. This tool uses JavaScript's regex engine, so patterns you build here will work directly in JavaScript, Node.js, and TypeScript.
How to use Regex Tester
Enter your regex pattern in the pattern field.
Add flags if needed (g for global, i for case-insensitive, m for multiline).
Paste or type your test text.
Matches highlight automatically.
Check capture groups in the results panel.
Examples
Match email addresses
A basic email pattern that catches most formats:
Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Test text:
Contact us at support@example.com or sales@company.co.uk
Matches:
✓ support@example.com
✓ sales@company.co.ukExtract numbers with capture groups
Parentheses create capture groups to extract specific parts:
Pattern: Price: \$(\d+\.\d{2})
Test: "Price: $19.99"
Full match: Price: $19.99
Group 1: 19.99 ← captured!Common patterns
Useful regex patterns for everyday tasks:
Phone (US): \(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4}
URL: https?:\/\/[\w\-._~:/?#@!$&'()*+,;=%]+
Date (YYYY-MM-DD): \d{4}-\d{2}-\d{2}
IP Address: \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}Features
When to use this
- •Validating email, phone, or URL formats
- •Extracting data from log files
- •Search and replace in text editors
- •Parsing structured text like CSV or logs
- •Building input validation for forms
- •Learning regex syntax and patterns