Regex Debugger
What the Regex Debugger does: test patterns live, replace and split, get a plain-English explanation, and export code for JavaScript, PHP, or Python.
Regular expressions without the guesswork
Regular expressions are powerful but unforgiving: one misplaced character and your pattern matches nothing — or suddenly far too much. The Regex Debugger takes the guesswork out of it. You type your regex pattern into one field and your test text into the other, and the tool shows you instantly what matches: every hit highlighted in color inside the text, capture groups underlined in color, and everything listed again with position and group values. In the same window you can also try out replacements and splits, have the pattern explained in plain English, and export it as ready-to-use code for JavaScript, PHP, or Python.
There's no "Run" button to wait for — evaluation happens in real time as you type (pressing Enter in the pattern field triggers it immediately as well). Edit the pattern and the matches follow along. That immediate feedback is what makes the difference: while you build, you see whether \d{3} actually fires, whether your capture group grabs the right thing, and exactly where your pattern gets too greedy.
The tool is built for everyone who works with patterns: developers building and testing an expression for validation, search, or replacement; admins and DevOps picking apart log lines or config values; and anyone learning regex who needs something visible to react against instead of simulating it in their head. Everything runs in the browser — no account, no installation. And because matching runs in a separate background thread with a time limit, even a pattern that goes off the rails won't freeze your tab.
What the tool does — at a glance
The interface is two columns: pattern, test text, and the result tabs on the left, a clickable cheat sheet on the right. In detail:
- Pattern — the editor for your regex pattern, with syntax highlighting and bracket matching. The slashes are fixed around the field; you pick the flags separately. Paste a complete literal such as
/\d+/giand the tool splits it into pattern and flags for you. - Flags — eight toggles:
g,i,m,s,u,v,y, andd.g(global, all matches) is on by default;uandvare mutually exclusive. - Library — 17 ready-made patterns (email, URL, IPv4/IPv6, dates, time, UUID, semantic version, Markdown link, and more), each with matching test text and some with a replacement.
- Test String — the input for the text your pattern runs against. Multi-line, with line numbers. Matches get a colored background (four rotating colors), capture groups a colored underline.
- Matches — the results list: a counter ("N matches"), and for each hit the matched text, its position, and all capture groups, named ones with their name. Click a match to select it in the test text.
- Replace — a preview of
String.replace()with$1,$<name>,$&, and friends; the result can be copied. - Split — the result of
text.split(regex)as a numbered list. - Explain — your pattern explained piece by piece in plain English.
- Code — ready-made code for JavaScript, PHP (PCRE), and Python (re), including notes on where the engines differ.
- Copy, Share, Clear — copy the pattern as
/pattern/flags, create a share link carrying pattern, flags, test text, and replacement, or empty the pattern and test text. - Errors and timeout — an invalid expression shows the engine's original error message; a pattern that runs longer than 1.5 seconds is stopped, with a hint about catastrophic backtracking.
- Cheat Sheet — a collapsible reference (Characters, Quantifiers, Groups, Anchors, Lookaround, Character Classes, Unicode, Replacement, Flags). One click inserts the building block into the pattern or the replacement field, or toggles the flag.
Your working state — pattern, flags, test text, replacement, and the open tab — is saved locally in your browser and comes back after a reload (only if all flags are off does the tool start with g again).
Which engine: native JavaScript
Important for working accurately: the debugger uses your browser's native JavaScript RegExp API — not PCRE, not the Python or .NET variant. Your pattern is evaluated internally as new RegExp(pattern, flags). That has two consequences:
- You test the exact engine that will later run in your JavaScript, Node.js, or TypeScript code. What matches here matches there.
- You need to know the JavaScript limits: the eight flags
g/i/m/s/u/v/y/d, named groups ((?<name>…)), and lookahead and lookbehind are available. PCRE specialties such as atomic groups, possessive quantifiers, recursion, or POSIX classes ([[:alpha:]]) are not. If you need the pattern in PHP or Python, the Code tab translates it and flags the spots where the engines differ. More on this in the manual and the tips.
Try it now
→ Open the Regex Debugger — type a pattern, paste test text, read the matches live. No account, free, right in the browser. On your first visit the tool starts with a ready-made example ((?<word>\w+) on a short sentence, plus the replacement [$<word>]) so you can see immediately how matches, position, and a named group are displayed. After that it opens with your last saved state — or you dip into the Library.
Related JPKCom tools
Regex is rarely an end in itself — it usually sits inside a larger text or code workflow:
- Coder — encodes and decodes HTML entities, URLs, Base64, JWT, and data URIs; handy before or after you slice strings with regex.
- Source Viewer — displays and highlights source code in over 100 languages; great for finding the spot your pattern should target.
- JSON Editor — formats and validates JSON; often the cleaner choice than a regex when you need to take structured data apart.
- Beautify — formats JavaScript, CSS, and HTML; helps make a long string readable before you point a pattern at it.
There's more on the subpages: the manual with every feature and the engine limits in detail, examples with runnable walkthroughs, and a collection of tips & tricks.