Live highlighting as you type
Matches update on every keystroke, so you see immediately whether a change widened or narrowed the pattern rather than discovering it after a batch run.
Test regular expressions against sample text with live highlighting.
Loading tool…
The tool is loading its code on your device. This happens once and is cached for later visits.
Processed entirely on your device
Overview
Free online regular expression tester with live match highlighting, capture group inspection, a replacement preview, a cheatsheet and plain-English explanations.
A regular expression is a program, and like any program it needs testing before deployment. The difference is that regex bugs are unusually silent: a pattern that matches slightly too much or slightly too little produces plausible-looking output that is quietly wrong.
The reliable method is incremental. Start with a literal substring that appears in a real match. Widen it one character class at a time, checking the highlight after each change. When it matches everything you want, add anchors and boundaries to exclude what you do not want. Writing a full pattern from memory and then debugging it is far slower than growing one that works.
g — global. Without it, most languages return only the first match. With it, they return all. Forgetting g in a replace operation is the classic "it only fixed the first one" bug.
i — case-insensitive. Useful for user-facing text. Dangerous for identifiers, where case carries meaning.
m — multiline. Redefines ^ and $ as line boundaries. Essential when processing a document line by line with a single pattern.
s — dotAll. Lets . match \n. Without it, .* stops at the end of a line, which surprises almost everyone the first time.
u — Unicode. Enables \p{...} property escapes and correct surrogate-pair handling. Use it whenever the input may contain emoji or non-BMP characters.
Each has an uppercase negation: \D, \W, \S.
Quantifiers are greedy. <.+> applied to <a><b> matches the entire string, because + consumes everything it can and only backtracks as far as necessary to satisfy the final >. If you wanted each tag separately, you need <.+?>.
The mental model: greedy means "take as much as possible, then give back until it works". Lazy means "take as little as possible, then take more until it works". Both arrive at a match; they arrive at different ones.
(?=...) positive lookahead — what follows must match, but is not consumed.(?!...) negative lookahead — what follows must not match.(?<=...) positive lookbehind — what precedes must match.(?<!...) negative lookbehind — what precedes must not match.Lookaround is the tool for matching a position based on context: a password containing a digit without consuming it, a price not preceded by a currency symbol, a word not followed by a comma.
Backtracking engines explore alternatives, and nested quantifiers multiply them. (a+)+b against aaaaaaaaaaaaaaaaac takes exponential time because the engine tries every possible way to partition the a's before concluding failure. If a pattern hangs on a non-matching input, that is what is happening. Restructure to remove the ambiguity, or use an engine with atomic groups or possessive quantifiers.
Step by step
Type your pattern into the expression field.
Set the flags you need — g for global, i for case-insensitive, m for multiline, s for dotAll.
Paste sample text into the test area; matches highlight as you type.
Inspect each match's index, length and capture groups in the results panel.
Try a replacement string and preview the substituted output before using it.
Why use it
What this tool is good for, and what it deliberately does not try to do.
Matches update on every keystroke, so you see immediately whether a change widened or narrowed the pattern rather than discovering it after a batch run.
Every match lists its named and numbered groups with their exact spans, which is where most of the real work in regex debugging happens.
Test $1, $<name> and $$ substitutions against your sample text and see the final output before committing the change to your codebase.
Execution runs with a step budget, so a pattern that would hang your editor reports the problem instead of freezing the tab.
Questions
Short, honest answers about quality, limits and privacy.