dev101.io

Regex Tools

Test, explain, and debug regular expressions with live match highlighting, group capture, and plain-English breakdowns.

2 tools in this category

Regular expressions are the most powerful and most bug-prone tool in a developer's toolkit. An innocent-looking pattern can match nothing, everything, or cause a catastrophic backtrack that freezes your server. Our regex suite gives you a live tester for rapid iteration and a structural explainer that walks through exactly what your pattern will do.

Tester vs Explainer

Regex Tester takes a pattern and input text and shows match highlights, capture groups, and replace output in real time. Use it when you have a pattern and want to verify behavior. Regex Explain takes a pattern and produces a structural tree plus plain English — use it when reviewing someone else's regex or debugging why a pattern fails.

Flags that matter

g is global (match all, not just the first). i is case-insensitive. m makes ^ and $ match per-line. s (dotAll) makes . match newlines. u enables full Unicode support. y is sticky (match only at lastIndex). d returns match indices. JavaScript regex does not have x (extended/verbose); use comments in code instead.

Avoiding catastrophic backtracking

Patterns with nested quantifiers on overlapping character classes — (a+)+, (.*)* — can take exponential time on certain inputs. Our Regex Explain tool flags these patterns as warnings. Prefer possessive quantifiers or atomic groups where supported, or rewrite the pattern to be deterministic.

Frequently asked questions

Which regex flavor does the tester use?

JavaScript (ECMAScript 2024). This is what you'll get in any browser, Node.js, or Deno environment. Differences from PCRE: no recursion, no `x` flag, no conditional groups, limited lookbehind support in older engines.

Does the explainer handle PCRE patterns?

Partially. Most common constructs are JS-compatible. PCRE-only features (recursion, conditional groups, `\G`) will surface as unsupported. Use the warning panel to see what was skipped.

Can I share my regex with a colleague?

Yes — both regex tools preserve the pattern, input text, and flags in the URL hash. Share the URL and your colleague sees the exact state.

Why does my regex match slightly differently here vs in my code?

Almost always a flag mismatch. The tester defaults to `g` but your code may omit it. Check your `new RegExp(pattern, flags)` call and match the flags in the tester.

Related categories