DataToolsLab
Regex & Pattern Tools

Regex Diff

Compare two regex patterns side-by-side, highlighting token-level differences.

Loading tool…

What is Regex Diff?

A diff tool specialized for regex patterns. Unlike a generic text diff, this one tokenizes each regex and aligns them structurally, so a changed quantifier on the same group shows as a single modification rather than a garbled text diff.

How it works

We tokenize both regexes, compute the longest common subsequence of tokens, then render a side-by-side view with additions, deletions, and unchanged tokens color-coded.

  1. Enter your input. Type or paste your input into the field above — the tool responds instantly.
  2. Review the result. Output updates live as you type. Everything runs entirely in your browser.
  3. Copy or download. Use the Copy button to grab the result, or Download to save it as a file.

Examples

Comparing two patterns

Paste two regexes and see where they differ textually — then test sample strings to understand behavioral differences.

Common mistakes

Text diff isn't equivalence

Different text can match identically, and similar text can match differently — semantic equivalence is only approximated.

Frequently asked questions

How does the diff work?

A line- and token-level diff of the two patterns, plus a sample-input comparison to expose behavioral differences.

Can I test my own samples?

Yes — run any string against both patterns and see which one matches.

Online