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, colour
{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
§ 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