Regex Tester
Test regular expressions against any text in real-time. View match details, capture groups, and preview replacements.
How to Use the Regex Tester
1
Enter a Pattern
Type a regular expression in the pattern field. Select flags like g (global) or i (case-insensitive). Click a quick pattern button for common patterns.
2
Add Test Text
Paste or type your test string in the text area. The tool shows results in real-time as you type, with matches highlighted and counted.
3
Review Results
See the number of matches, highlighted matches in context, and each match's index and captured groups. Optionally enter a replacement string to preview substitutions.
Common Regex Patterns Reference
| Pattern | Matches | Description |
|---|---|---|
| [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} | user@example.com | Email address validation |
| https?://[^\s/$.?#].[^\s]* | https://example.com | URL matching |
| \(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4} | (555) 123-4567 | US phone number |
| \d{4}-\d{2}-\d{2} | 2026-07-14 | Date (YYYY-MM-DD) |
| \b(?:\d{1,3}\.){3}\d{1,3}\b | 192.168.1.1 | IPv4 address |
| #[0-9a-fA-F]{6}\b|#[0-9a-fA-F]{3}\b | #ff0000 | Hex color code |
Frequently Asked Questions
This tester uses JavaScript's built-in RegExp engine. It supports all standard JavaScript regex features including lookaheads, lookbehinds, named capture groups, and the 's' (dotall) flag.
g (global): find all matches. i (case-insensitive). m (multiline): ^ and $ match line boundaries. s (dotall): . matches newlines. u (unicode): enable Unicode features. y (sticky): match from lastIndex.
Capture groups are parts of a pattern enclosed in parentheses (). They "capture" the matched text for use in replacements or for extraction. Named groups use (?<name>...) syntax.
Yes. Enter a replacement string in the "Replacement" field. Use $1, $2, etc. for captured groups, $& for the full match, or named groups with $<name>.
Ad