Regex Tester & Explainer
Type a pattern and a test string — matches are highlighted live, capture groups are listed, and the pattern is explained in plain English. Everything runs in your browser.
About this tool
Tests JavaScript regular expressions exactly as your code would run them — the pattern is compiled with the browser's own RegExp engine, so behaviour matches Node.js and every modern browser. Alongside live match highlighting and capture-group inspection, the tool tokenizes the pattern and describes each construct (anchors, classes, quantifiers, groups, lookarounds) in plain English.
Your patterns and test data never leave the page — there is no server, no upload, and no tracking of tool inputs.
Frequently asked questions
Why does my regex work here but not in Python, grep, or Java?
Regex flavors differ. This tool uses JavaScript's RegExp engine, so results match Node.js and browsers exactly. Python uses (?P<name>...) for named groups where JavaScript uses (?<name>...), classic grep (BRE) requires backslashes before + and ? and has no lookarounds, and shorthand classes like \d can behave differently under Unicode settings. Always test in the engine you will ship with.
Why does my regex only match the first occurrence?
You are missing the g (global) flag. Without it, exec and match stop after the first match. Related gotchas: m makes ^ and $ match at every line boundary instead of only the string ends, and s lets . match newlines. All four flags are toggleable above the test string on this page.
What is the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +, {n,}) match as much as possible and then backtrack; lazy ones (*?, +?) match as little as possible. The classic symptom: <.+> applied to <a><b> matches the whole string, while <.+?> matches just <a>. Often the more robust fix is a negated class like <[^>]+>, which cannot overshoot at all.
What is catastrophic backtracking (ReDoS)?
Patterns with nested or overlapping quantifiers, like (a+)+$ or (\w+\s?)*$, can force the engine to try an exponential number of paths on a non-matching input — freezing the page or, server-side, enabling a denial-of-service attack (ReDoS). Avoid nesting quantifiers over the same characters, prefer negated character classes, and keep patterns anchored and specific, especially when the input is user-controlled.
Should I parse HTML or JSON with a regex?
For anything nested or recursive, no — regular expressions cannot track arbitrarily nested structure, so use a real parser (DOMParser for HTML, JSON.parse for JSON). Regex is fine for extracting flat snippets from text. If what you actually want is to pull values out of a JSON document, a query language fits better — try the JSONPath Tester on this site.