Regular Expressions · Test & Debug

Every pattern, on the right track.

Type a regex, paste your text, and see matches light up — with a railroad diagram of your pattern, capture groups laid bare, replace and split modes, and a ReDoS guard that catches catastrophic backtracking before your tab does.

  • 100% client-side — zero uploads
  • Railroad diagram of every pattern
  • ReDoS backtracking guard
regexmate — signal box console idle
Test Text
0 chars · 0 lines
Results — matches
// Matches appear here — type a pattern and paste some text.
// Every match lists its capture groups; the preview highlights hits.
Railroad Diagram — pattern structure 0 capture groups
// The diagram appears here — parse your pattern into its syntax tree,
// drawn as a railway: branches are alternations, loops are quantifiers.
literal character class capture group non-capturing *quantifier loop ?lazy
§ 01 — SIGNAL NOTICES

Built for the hardest regex debugging

The features you reach for when text cleaning or log extraction goes sideways.

Three Modes

Match lists every hit with capture groups, Replace runs templates with $1 references, Split carves text at matches. One tab, whole workflow.

Railroad Diagrams

Your pattern is parsed into an AST and drawn as a railway — alternations branch, quantifiers loop, capture groups box their contents with solid borders.

ReDoS Guard

Nested quantifiers like (a+)+ are flagged the moment you type them, and execution time is measured — catastrophic backtracking is caught before your tab freezes.

Instant Everything

Flags toggle with one click, results recompute as you type, matches highlight in a live preview — all computed locally, with nothing uploaded.

§ 02 — REFERENCE SHEET

Regex cheat sheet

The tokens the engine understands, ready to copy into your pattern.

TokenMeaningExampleMatches
.Any charactera.cabc, a7c
\d \w \sDigit, word char, whitespace\d+42, 2026
[abc] [^abc]Character class / negated[a-z]+hello
* + ?0+, 1+, 0 or 1 repetitionscolou?rcolor, color
{2,5}Between n and m repetitions\d{4}2026
*? +?Lazy (minimal) quantifiers<.*?>first tag only
( ) (?: )Capturing / non-capturing group(ab)+ababab
(?<name>)Named capture group(?<y>\d{4})year "y"
|Alternation (or)cat|dogcat, dog
^ $Start / end of string (line with m)^ERRORline starting ERROR
\bWord boundary\bend\bend alone
(?= ) (?! )Lookahead / negative lookahead\d(?=px)4 in 4px
\1 … \9Backreference to group n(\w+) \1boom boom

When the pattern refuses to cooperate

You already know the syntax — the problem is figuring out why a perfectly reasonable expression silently matches nothing, or worse, matches everything. RegexMate is for developers, QA engineers, and data analysts who need to see exactly where a pattern diverges from expectation without scattering console.log statements across a codebase. Paste a real payload, toggle flags like g or s, and watch captures populate side by side with the source text. It replaces guesswork with a visible, immediate answer.

From raw payload to readable text

  1. Type your pattern into the regex field and toggle the g, i, m, or s flags as needed.
  2. Paste or load a sample into the test string area, or click Sample for quick reference data.
  3. Choose Match, Replace, or Split to switch how results are computed and displayed.
  4. If replacing, enter your substitution string in the Replace with field and review the output panel.
  5. Click Copy to grab the final result, or Clear to reset all fields for the next pattern.
§ 03 — FIELD MANUAL

Frequently Asked Questions

How do I test a regular expression online?

Type your pattern into the regex bar (with or without slashes), set flags like g or i, and paste test text into the left pane. RegexMate highlights every match instantly, lists capture groups for each match, and renders a railroad diagram of the pattern so you can see its structure.

What do the regex flags g, i and m mean?

g (global) finds every match instead of stopping at the first. i (ignore case) matches letters case-insensitively. m (multiline) makes ^ and $ match at line boundaries instead of just the start and end of the whole text. s (dotAll) lets . match newlines. Toggle them with the flag buttons under the pattern bar.

How do capture groups work?

Parentheses create capture groups: the text each group matched is stored and shown per match. In the railroad diagram every capture group is drawn as a solid box with its number — group 1 is the first ( from the left. Non-capturing groups (?:…) are drawn with a dashed border because they group without capturing. Named groups (?<year>\d{4}) show their name instead of a number.

What is catastrophic backtracking (ReDoS)?

Some patterns — typically nested quantifiers like (a+)+ or overlapping alternations like (a|aa)+ — force the regex engine to retry exponentially many paths on hostile input. The browser tab freezes: that is a Regular Expression Denial of Service. RegexMate statically flags these constructs when you type them and measures execution time, so the danger is visible before it bites.

How does the railroad diagram help?

The diagram parses your pattern into an abstract syntax tree and draws it as a railway: characters ride left to right along the track, alternations split into parallel branches, and quantifiers loop back around. Group borders, greedy versus lazy quantifiers and class negation become visible at a glance — much faster than squinting at raw pattern text.

What is the difference between greedy and lazy quantifiers?

Greedy quantifiers (* + ? {n,m}) grab as much text as they can and give characters back only if the rest of the pattern fails. Lazy ones (*? +? ??) grab as little as possible and expand only when needed. In the railroad diagram lazy loops carry a small ? marker. Matching HTML tags is the classic case: <.*> matches a whole line, <.*?> stops at the first >.

How do I replace or split text with a regex?

Switch the mode tabs above the workspace: Replace runs your pattern against the text with a replacement template — $1, $2 insert capture groups, $& the whole match — and shows a preview plus a copy button. Split divides the text at every match and lists the resulting segments. Match mode stays the default for testing.

Is my text uploaded to a server?

No. Parsing, matching, replacing and diagram rendering all run in your browser with client-side JavaScript. Nothing is transmitted, logged or stored — safe for logs, customer data and source code.

Latest Articles

5 Most Common Regex Patterns That Cause Catastrophic Backtracking
You paste a regex into your testing tool, hit "evaluate," and the tab locks up. Your CPU fan screams. The browser asks if you want to kill the page.
Atomic Groups vs Possessive Quantifiers: How to Fix Backtracking Locally
Back in 2019, a single regular expression brought down a major cloud provider's API gateway. The culprit?
Anatomy of Catastrophic Backtracking: What Triggers Regex CPU Spikes?
Most developers treat regex quantifiers like seasoning. A pinch of + here, a dash of * there — if one quantifier matches a range, surely nesting two gives you "more flexibility."
What is a ReDoS Vulnerability in Regular Expressions? (A Beginner's Guide)
Here's the scene. You've got a form field that needs to validate email addresses. You fire up your favorite regex testing tool, paste in a pattern you found on Stack Overflow, drop in a few test…
Regex Visualizer vs ReDoS Protection: End CPU Spikes
Regex visualizer or ReDoS protection tool? We pit both against catastrophic backtracking, expose common mistakes, and show which stops CPU hangs. Compare now.
How to Use a Regex Railroad Diagram to Detect ReDoS in Complex Patterns
A railroad diagram shows nested quantifiers as a loop inside a loop. Measured on the same pattern: /^(\w+\s?)+$/ grows about 4x per two characters, reaching 1.15 s at 28 characters, while the rewritten pattern stays under 0.01 ms.
ReDoS Regex Debugger: 5-Step Routine Fixing Flaws 2026
Stop catastrophic backtracking. Learn my step-by-step routine to identify and fix ReDoS vulnerabilities fast using a client-side regex debugger. Try it now!
Regex Visualizer: Solve Catastrophic Backtracking Fast
Is your regex hanging the app? Learn to spot catastrophic backtracking using a regex visualizer and railroad diagram. Stop freezing patterns and fix it now!
Regex Visualizer: Fixing Catastrophic ReDoS Nightmares
I froze production with catastrophic backtracking. Watch a regex visualizer expose ReDoS mistakes and fix them. Learn from my disaster and try it today!
ReDoS Regex Debugger: Stop 10-Second Login Form Hangs
A pattern can pass every correctness test and still double its runtime on every extra character. The three structural causes of catastrophic backtracking, the timing signature, and the rewrites.
Regex Railroad Diagram: Catch vs Guess ReDoS (3 Steps)
Want to stop ReDoS? This 3-step tutorial shows how a regex railroad diagram spots catastrophic backtracking fast. Choose visual vs blind fixes. Start reading!
How to Use Railroad Diagrams to Identify ReDoS Vulnerabilities in Complex Regex Patterns
In July 2019, a single regular expression brought down Cloudflare's global CDN for 27 minutes. The pattern was 29 characters long.
2 Ways Regex Visualizer Spots Catastrophic Backtracking
Stop guessing why patterns hang. Compare blind testing against a regex visualizer exposing catastrophic backtracking via match highlighting. Read the guide!
5-Min Catastrophic Backtracking Fix: Code vs Diagrams
Contrast raw regex code versus visual railroad diagrams to end catastrophic backtracking. Stop infinite loops fast. Read our guide to fix patterns today!
Railroad Diagrams: Stop Regex Catastrophic Backtracking
Eliminate catastrophic backtracking and prevent ReDoS using railroad diagrams. Follow this evidence-led checklist to debug complex regex patterns securely.
Regex Split Tool: Manual Mess vs Clean Extracts
Avoid greedy traps! We compare manual messes vs clean splits, proving our online regex split tool wins at extracting specific string patterns. Read the review!
Why Most Regex Debugger Tools Fail: Compared
We compare two regex debugger tools side by side, exposing typical coding mistakes and evidence-led fixes. See which tool catches patterns. Read the review.
Regex Replace: Strip 10k Tracking URLs Instantly
Learn how to use regex replace for bulk text processing. We tested this workflow on 10,000 rows and cut cleaning time by 95%. Read the full step-by-step guide.
Regex Pattern Matching: Flawed vs Fixed Log Parsing
Avoid broken parsers. See common regex pattern matching mistakes parsing log files, learn why they fail, then apply step-by-step fixes. Read the guide now.
3 Client-Side Regex Tester Methods Highlighting Matches
Build a client-side regular expression tester. Real-time match highlighting processed 5,000 lines in 12ms locally. Fix patterns faster. Try the demo now.
Test Regex ReDoS: 4-Step Vulnerability Audit Workflow
Execute an end-to-end workflow to test regular expressions for ReDoS vulnerabilities. Run these concrete steps to eliminate catastrophic backtracking now.
Regex Visualizer Guide: 5 Mistakes Fixed Side-by-Side
Stop guessing. This regex visualizer guide compares manual coding vs visual debugging, exposing five beginner mistakes and fixing them step-by-step. Start now.
Regex String Split: matchAll vs split Highlight Showdown
Regex string split with match highlighting tested across 1,000 iterations. See why matchAll beats split() capturing edge cases. Read the full workflow now!
Best Online Regex Debugger for Catastrophic Backtracking
Quick tip that'll save your weekend: if you see a quantifier nested inside another quantifier with overlapping character classes — like (a+)+ or (a|a)*b — stop.
Regex Cheat Sheet for Advanced String Manipulation
Most regex cheat sheets hand you a table of metacharacters and call it a day. You bookmark it.
Read Regex Railroad Diagrams: 5 Steps, 1 Real Fix
Struggling to read regex railroad diagrams? I debugged one complex pattern and learned 5 clear steps. Master pattern matching today. Read my full tutorial now!
Client-Side Regex Replace: Clean 4,200 Rows Locally
Stop exposing sensitive text. Our client-side regex replace tool processes data locally, fixing 4,200 rows instantly. See the worked example and try it now.
ReDoS Protection: Fix Fatal Regex Flaws In 5 Minutes
Discover what ReDoS protection is and how to prevent regex denial of service. Expose fatal regex mistakes, apply proven fixes, and secure apps. Start now!
Free Online Regex Tester with Railroad Diagram Generator
Test and debug your regular expressions using our free online regex tester. Includes a railroad diagram generator to easily visualize patterns. Try it now!
Regex Visualizer: Debug Complex Regular Expressions
Struggling with patterns? Learn how to use a regex visualizer to debug complex regular expressions easily. Fix errors fast and simplify your workflow. Read now!

View All Articles →