Online Regex Tester & Visual Debugger
Test JavaScript regular expressions with live highlighting, flags, group breakdown, and error messages. Everything runs locally in your browser.
JavaScript-style regex. You can also toggle flags below; they will sync with this field.
Highlighted matches
Match details
How this regex tester works
This tool uses the built-in RegExp engine in your browser (ECMAScript/JavaScript flavor). Every time you change the pattern, flags, or test string, the tester:
- Builds a new RegExp with the selected flags.
- Runs it against the test string (using exec in a loop when g is set).
- Highlights matches and capturing groups in the text.
- Displays a structured table of matches, groups, and named groups.
Commonly used flags
- g – global: find all matches instead of stopping after the first.
- i – ignore case: make the pattern case-insensitive.
- m – multiline: ^ and $ match line boundaries, not just the whole string.
- s – dotAll: . also matches newline characters.
- u – Unicode: enables full Unicode support and Unicode escapes like \p{L}.
- y – sticky: matches must start exactly at lastIndex.
Examples you can try
-
Email-like strings:
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g -
IPv4 addresses:
/\b(?:\d{1,3}\.){3}\d{1,3}\b/g -
Capture date parts:
Groups 1–3 will contain year, month, and day.
/(\d{4})-(\d{2})-(\d{2})/
Tips for debugging regular expressions
1. Start simple
Begin with a small pattern that you know works, then gradually add more pieces. This makes it easier to see where things break.
2. Use capturing groups strategically
Capturing groups ( ... ) not only help you extract data, they also make the highlighted output easier to understand. Use non-capturing groups (?: ... ) when you only need grouping, not extraction.
3. Be careful with greediness
Quantifiers like +, *, and {m,n} are greedy by default. If your match “eats” too much, try the lazy versions: +?, *?, {m,n}?.
4. Remember engine differences
Many online tools use PCRE or .NET regex engines. This tester uses JavaScript’s engine, which is similar but not identical. Some advanced constructs (like atomic groups or backtracking control verbs) are not supported.
FAQ
Is this safe for sensitive data?
Yes. All processing happens in your browser; the pattern and test string are not sent to a server. Still, avoid pasting fully identifiable personal data when possible.
Can I test multiline logs?
Yes. Paste any multiline text into the test area. Use the m flag if you want ^ and $ to match the start and end of each line.