Regex Tester & Debugger: Online
Write a pattern and watch it match, live. Highlighted results in your test string, a full capture-group table with named groups and indices, a replace preview, a flag toolbar and a pattern library, all running on your browser's own RegExp engine.
What is the regex tester?
The Regex Tester builds and debugs regular expressions with live match highlighting in your test string. Toggle the g/i/m/s/u/y flags, inspect numbered and named capture groups, preview a find-and-replace, and load ready-made patterns from a library. Free and in-browser, running on the browser's own RegExp engine: nothing is uploaded.
A regular expression is only as trustworthy as the last string you tested it against, and mentally simulating a pattern character by character is where most regex bugs are born. This Regex Tester replaces that guesswork with a live picture: type a pattern and every match is highlighted directly inside your test text the instant you stop typing, so a greedy quantifier that swallows too much or an anchor that never fires is obvious at a glance rather than hidden behind a lonely 'no match'. Underneath the highlighting, a structured table breaks each match into its full value, its numbered capture groups, and any named groups (the `(?<year>\d{4})` kind), together with the exact start index and length: the details you need when you're pulling fields out of a log line or a URL. A dedicated replace field previews the result of a substitution using `$1`, `$<name>` and `$&` backreferences so you can perfect a find-and-replace before you run it anywhere destructive. The flag toolbar exposes global, case-insensitive, multiline, dotAll, unicode and sticky as one-click toggles with plain-English tooltips, an inline cheat-sheet keeps the token syntax within reach, and a library of battle-tested patterns (email, URL, IPv4, UUID, hex color, slug and more) is one click from being inserted. Crucially, it uses the browser's native RegExp implementation, the very engine that runs your JavaScript, so what matches here is exactly what will match in your `String.matchAll` in production, and because it all happens in your tab, no pattern or test data is ever uploaded.
- Difficulty:
- Easy
- Typical time:
- ~15s
- Processing:
- 100% browser processing
Last updated
How to use the regex tester
- 1
Enter your pattern and flags
Type a regular expression into the pattern field (no surrounding slashes needed) and click the flag buttons (g, i, m, s, u, y) to control how it matches. Or insert one from the pattern library to start.
- 2
Paste your test string
Drop the text you want to match into the test area: type it, paste it, or drag a.txt/.log file straight onto the pane. Matches highlight instantly as both fields change.
- 3
Read the highlights and group table
Scan the highlighted matches in your text, then open the match table to see every capture group, named group, index and length for each hit.
- 4
Preview a replacement (optional)
Type a replacement string with $1, $<name> or $& backreferences to see the substituted result update live, then copy the final output.
- 5
Copy or share
Copy the pattern, the replaced output, or share a link that reopens the exact pattern, flags and test string you're working on.
What Regex Tester includes
Live match highlighting
Every match is painted directly onto your test string as you type, overlapping colors for adjacent matches and a distinct tint for the active one, so you instantly see what a pattern grabs instead of guessing from a match count.
Full capture-group table
Each match expands into its numbered groups ($1, $2…) and any named groups like (?<name>…), with the exact start index and length, so pulling structured fields out of messy text becomes a copy-paste away.
Live replace preview
Type a replacement using $1, $<name> or $& backreferences and see the fully substituted output update in real time, perfect the find-and-replace here before you run it in an editor or a script.
One-click flag toolbar
Toggle g, i, m, s, u and y as buttons with plain-English tooltips (global, ignore-case, multiline, dotAll, unicode and sticky) and watch the results re-evaluate the moment you change one.
Ready-made pattern library
Insert vetted patterns for email, URL, IPv4, UUID, hex color and URL slug with a single click, then tweak them against your own data, a fast, correct starting point instead of a Stack Overflow copy-paste.
Built-in cheat-sheet
A collapsible quick-reference lists anchors, character classes, quantifiers, groups and lookarounds with concrete examples, so you can learn or double-check syntax without leaving the tab.
Why use our regex tester
See the match, not just a boolean
Most regex debugging fails because you can't see where a pattern lands. Highlighting the matches inside the actual text turns an abstract expression into something you can literally read, so mistakes surface in seconds.
Exactly the engine your code uses
This tester runs the browser's native RegExp, the same implementation behind JavaScript's match, matchAll and replace. What matches here is what matches in your app, with no dialect surprises between the tool and production.
From zero to a working pattern faster
Start from a library pattern, adjust it while the highlighting and group table update live, and check the cheat-sheet inline. You spend your time refining a pattern instead of context-switching to docs.
Private by construction
Log lines, tokens and personal data often end up in the test string. Because everything runs in your browser tab, none of your patterns or sample text is ever transmitted, stored or logged.
Built for the way you work
From quick one-off fixes to daily workflows, see how people put this tool to use.
- Backend & data engineers
Extract fields from log lines
Craft a pattern with named groups to pull timestamps, IPs and status codes out of raw logs, verify it against real samples with the highlighter, and lift the exact indices for downstream parsing.
- Frontend developers
Nail form-validation regexes
Start from the email or URL library pattern, test it against tricky edge cases, and confirm it behaves identically to your JavaScript because it runs on the very same RegExp engine.
- Writers & content teams
Perfect a find-and-replace
Preview a substitution with backreferences on a paragraph before committing it in an editor, so a bulk rewrite of dates, links or slugs does exactly what you intend the first time.
- Students & the regex-curious
Learn regex by watching it work
Toggle a flag and watch the highlights shift, expand a group to see what it captured, and lean on the cheat-sheet: a hands-on way to build real intuition for how patterns behave.
Supported formats
Accepts Regular expression, Test string, Replacement string, .txt and .log, and produces Highlighted matches, Capture-group table, Replaced text and Copied pattern, all processed locally in your browser.
- Regular expression
- Test string
- Replacement string
- .txt
- .log
- Highlighted matches
- Capture-group table
- Replaced text
- Copied pattern
Frequently asked questions
Recommended tools
JSON Formatter
Format, validate and minify JSON in your browser with pinpoint error line + column, jump-to-error, key sorting and live editing: nothing is uploaded.
URL Encoder
Percent-encode text and URLs instantly: pick component mode for query values or full-URL mode to preserve structure, with a per-line batch switch. 100% in your browser, nothing uploaded.
JSON to TypeScript
Convert JSON to TypeScript interfaces or types instantly, with merged unions across array items, optional-from-null, readonly, export and naming controls, 100% in your browser.
Base64 Encoder
Encode text or any file to Base64 instantly: Unicode-safe, with a URL-safe toggle and one-click data URLs. Runs entirely in your browser, nothing uploaded.
Barcode Generator
Generate scannable 1D barcodes (CODE128, EAN-13, UPC-A, CODE39, ITF-14, MSI, pharmacode and Codabar) live in your browser, with per-format validation and PNG or SVG export. Nothing is uploaded.
Base64 Decoder
Decode Base64 back to text or a file instantly: Unicode-safe, auto-detects URL-safe input, sniffs binary data and offers a download. Runs fully in your browser, nothing uploaded.
Common problems, solved
Hit a snag? Here are quick fixes for the issues people run into most.
'Invalid regular expression' appears as I type.
The pattern is only partially written: an unclosed group, class or quantifier. This is normal mid-edit. The error clears as soon as the expression is syntactically complete. If it persists, look for an unescaped special character (escape a literal dot as \. and a literal slash as \/), or an unbalanced ( or [.
The pattern matches in another tool but not here.
This tester runs the browser's ECMAScript RegExp, which differs from PCRE, Python or .NET flavours. Features like possessive quantifiers, recursion, or some lookbehind constructs may be unsupported. Rewrite using JavaScript-compatible syntax, and remember to enable the u flag for Unicode property escapes.
^ and $ only match the very start and end of my text.
By default ^ and $ anchor to the whole string, not each line. Turn on the m (multiline) flag so they match at every line break, which is what you usually want when scanning log lines or multi-line input.
The replace preview shows a literal $1 instead of the group.
Make sure your pattern actually contains a capturing group for that number. $1 needs a first ( … ) group. To output a literal dollar sign, write $$. For named references the syntax is $<name>, matching a (?<name>…) group in the pattern.
Get the most out of it
You don't type the slashes: enter foo, not /foo/g, and set g/i/m/s/u/y with the flag buttons.
Use named groups (?<name>…) for readable extraction, then reference them in the replace field as $<name>.
Add the u (unicode) flag to use \p{…} property escapes like \p{L} for any letter or \p{Emoji} for emoji.
If a quantifier grabs too much, make it lazy by adding ?,.*? instead of.*, and watch the highlight shrink.
Share the link to hand a teammate the exact pattern, flags and test string. They all travel in the URL, never a server.
What's new
Recent updates and improvements to the regex tester.
Initial release: live match highlighting, g/i/m/s/u/y flag toolbar, capture-group table with named groups and indices, and a collapsible regex cheat-sheet.
Added the live replace preview with $1/$<name>/$& backreferences and a one-click pattern library (email, URL, IPv4, UUID, hex color, slug).
Added drag-and-drop/paste import for .txt/.log test data, shareable deep links carrying pattern, flags and text, plus keyboard shortcuts with an in-app reference.
Keep exploring
Problems we solve
Definitions
From the blog
Explore categories
Common tasks
Your privacy is built in
Your regular expression, test string and replacement are evaluated entirely inside your browser using the native RegExp engine: the same one that runs your JavaScript. Nothing is uploaded, stored or logged on our servers, so it's safe to test patterns against real log lines, tokens or personal data. Everything is discarded the moment you close the tab.
- Runs in your browser
- No uploads
- Nothing stored
Ready to try the regex tester?
Free, private and instant. Regex Tester runs right in your browser.