Regex Tester
Write a pattern, paste your test text, and see every match highlighted instantly — with match positions, numbered capture groups, and named groups broken out for each result. Invalid patterns show the exact JavaScript error. Nothing you test ever leaves your browser.
Pattern
Flags
Test String
How to Use Regex Tester
Enter your pattern and flags
Type the regular expression in the pattern field and adjust flags — keep g to find all matches, add i for case-insensitive matching.
Paste your test text
Add the text you want to match against. Every match is highlighted instantly, with a live match count above the preview.
Inspect the match details
Review each match's position and capture group values in the details list to confirm your pattern extracts exactly what you intended.
About Regex Tester
Why test regex before shipping it
Regular expressions are compact and powerful, which is exactly why they fail in surprising ways. A pattern that works on your first example can miss edge cases, match too greedily, or behave differently with multiline input. Testing against realistic sample text before the pattern goes into production code catches these issues in seconds instead of in a bug report. This tester uses your browser's actual JavaScript regex engine, so behavior matches exactly what your Node.js or frontend code will do — same syntax, same flags, same quirks.
Flags, groups, and what they do
The six JavaScript flags change how a pattern behaves: g finds all matches instead of stopping at the first, i ignores case, m makes ^ and $ match at line boundaries, s lets the dot match newlines, u enables full Unicode handling, and y anchors matching to an exact position. Capture groups — parentheses in your pattern — extract sub-parts of each match, and named groups like (?<year>\d{4}) label them readably. This tool lists every group's captured value per match, which is the fastest way to verify your extraction logic.
Safe, private, and instant
Matching runs live in your browser as you type, with no server round-trip — patterns and test text are never uploaded or logged, so testing against real production data like log excerpts or customer records stays private. To keep the page responsive, test input is capped at 50,000 characters and match listings at 2,000 results, which prevents runaway patterns from freezing your tab. Error messages come straight from the JavaScript engine, so what you see here is exactly what you'd see in your console.
Common uses for Regex Tester
- Validate email, phone, and URL patterns against realistic sample data before deploying
- Debug why a pattern in your code isn't matching what you expected
- Extract structured data from log lines using capture groups
- Test find-and-replace patterns before running them across a codebase
- Learn regex interactively by watching matches update as you edit the pattern
Frequently Asked Questions
Why does my pattern only find one match?
Without the g (global) flag, JavaScript regex stops after the first match — that's the language's default behavior, not a bug. Add g to your flags to find every match in the text. The tool shows a reminder next to the match count when the global flag is missing so you can spot this quickly.
Will this behave the same as regex in my code?
If your code is JavaScript or TypeScript, yes — this tool uses your browser's native RegExp engine, the same one Node.js is built on. Other languages differ in places: Python uses (?P<name>) for named groups, and PCRE supports possessive quantifiers JavaScript lacks. Core syntax like character classes, anchors, and quantifiers is portable across all of them.
How do I see what my capture groups matched?
Every match in the results list shows its position in the text plus each capture group's value — numbered groups appear as $1, $2, and so on, while named groups like (?<domain>...) appear under their names. Empty groups are labeled explicitly, which helps you distinguish a group that matched nothing from one that didn't participate at all.
What does the 50,000 character limit protect against?
Certain patterns — typically nested quantifiers like (a+)+ — trigger catastrophic backtracking, where matching time explodes exponentially with input length. Capping the test string keeps worst-case patterns from freezing your browser tab. For testing against bigger files, run a representative excerpt here first, then apply the verified pattern in your own environment.
Is my test data private?
Completely. Pattern matching happens in your browser using client-side JavaScript — neither your regex nor your test text is transmitted, stored, or logged anywhere. That makes it safe to test against real log lines, user data samples, or anything else you wouldn't paste into a random website's server.