Regex tester
Test a regular expression and see every match live.
The regex tester runs your pattern and flags against a test string using your browser's native regex engine, showing every match's full text, position, and any capture groups — updated live as you type.
How to use
- Enter your pattern (without the surrounding slashes) and any flags (e.g. "gi").
- Paste your test string — matches update live as you type.
- Each match shows its full matched text, position, and any capture groups.
Common use scenarios
- Building and debugging a regular expression before using it in code.
- Checking whether a pattern matches the cases you expect, and only those cases.
- Understanding what a regex someone else wrote actually matches.
- Extracting or validating structured pieces of text (like IDs or codes) with capture groups.
✓Content & verification reviewed: 2026-08-25
How we verify Regex tester
How to confirm your pattern is doing what you think it's doing.
The global flag is applied automatically to show every match
Even if you don't type "g" in the flags field, the tool adds it internally so you see every match in the test string, not just the first one — your other flags (like "i" or "m") are used exactly as entered.
Capture groups are numbered in the order they open
Group 1 is the first opening parenthesis in your pattern, Group 2 the second, and so on — a group with "(?:...)" (non-capturing) doesn't get a number at all, so if your group numbering looks off, check for non-capturing groups in your pattern.
This uses your browser's regex engine, not a universal standard
JavaScript's regex flavor supports most common syntax, but some advanced features (like certain lookbehind patterns) depend on your specific browser — a pattern written for another language (like Python or PCRE) may need small adjustments here.
Before you rely on the result
- You're testing against example strings that should match and ones that shouldn't, not just one case.
- You understand capture groups are numbered by their opening parenthesis, skipping non-capturing groups.
- If a pattern behaves unexpectedly, you've checked it against JavaScript's specific regex syntax rather than another language's.
- You've tried edge cases (empty input, repeated matches, boundary characters) relevant to your use.
Who this is for
- Anyone building and debugging a regular expression before using it in code.
- People checking a pattern matches exactly the cases they expect.
- Anyone trying to understand what someone else's regex actually matches.
- People extracting or validating structured text with capture groups.
Real-world examples
Validating an input format
A developer writing a pattern to validate a product code format tests it against several valid and invalid example codes to confirm it behaves correctly before adding it to a form.
Extracting data with groups
Someone needing to pull a date and an ID out of a line of log text writes a pattern with two capture groups and confirms each group captures the right piece.
Understanding an inherited pattern
A developer who inherited code with an unfamiliar regex pastes it in along with sample inputs to see exactly what it matches before changing it.
Limitations
- Uses your browser's native JavaScript regex engine — syntax support (e.g. lookbehind) depends on your browser, and a pathological pattern can still run slowly or hang the tab.
Frequently asked questions
Do I need to add the "g" flag myself?
No — it's applied automatically so you always see every match in your test string, regardless of what you type in the flags field.
Why doesn't my group show up as Group 1?
Non-capturing groups, written as "(?:...)", don't count toward group numbering — if your pattern includes one, the numbered groups shift accordingly.
Why does a pattern from a tutorial in another language not work here?
This tool uses JavaScript's native regex engine, which doesn't support every feature from every other regex flavor — some adjustment may be needed for patterns written for Python, PCRE, or similar.
Can a bad pattern freeze the page?
A pathological pattern with catastrophic backtracking can run very slowly on certain inputs — if the tab seems stuck, simplify your pattern or shorten your test string.
🔒 Runs in your browser — nothing is uploaded. Results are for reference only; see the disclaimer. Last updated: 2026-08-25
Subscribe for updates
New tools and tips, straight to your inbox. No spam, unsubscribe anytime.