Regex Tester
Test JavaScript regular expressions against your text with live match highlighting, a match table with positions and every capture group, a plain-English breakdown of the pattern and a replace preview. A safety timeout stops runaway patterns.
This tool runs entirely in your browser.
How to use the Regex Tester
- 1Enter a pattern and choose flags (g, i, m, s, u).
- 2Type or paste the test text — matches are highlighted as you type.
- 3Check the match table for each match’s start and end index and the value of every numbered or named group.
- 4Read the pattern breakdown to see what each group, class, quantifier and anchor does, or enter a replacement to preview the result.
What is the Regex Tester?
The tester uses your browser’s JavaScript regex engine, so behaviour matches Node.js and browsers exactly. Matching runs in a background worker with a timeout, so catastrophic backtracking cannot freeze the page.
The pattern breakdown splits the expression into a tree — capturing, named and non-capturing groups, lookahead and lookbehind, character classes and ranges, shorthand escapes like \d and \w, Unicode properties such as \p{L}, quantifiers (greedy or lazy), anchors, alternation and backreferences — and explains each part in plain English. It is a quick way to understand a regex you found in someone else’s code.
In-depth guide
Build and Debug a JavaScript Regex Step by Step →Frequently asked questions
Does it support lookbehind and named groups?
Yes — all modern JavaScript features including (?<name>…), lookbehind (?<=…) and the s (dotAll) and u (Unicode) flags.
What is the difference between greedy and lazy quantifiers?
A greedy quantifier like .* takes as much text as it can and gives back only if the rest of the pattern fails; a lazy one like .*? takes as little as possible. On “<b>x</b>”, <.*> matches the whole string while <.*?> matches just “<b>”. The breakdown labels each quantifier as greedy or lazy.
Why does a group show “—” in the match table?
The group didn’t take part in that match — for example the unused side of an alternation like (a)|(b), or an optional group (x)? that was skipped. JavaScript reports such groups as undefined.
Is my pattern or text sent anywhere?
No. Matching and the breakdown both run in your browser; nothing is uploaded.
Is the Regex Tester free and private?
Yes. The Regex Tester is free, needs no account, and runs entirely in your browser. What you type is never sent to a server or stored.
Related tools
All developer tools →- Find and ReplaceFind and replace text, with regex support.
- Text DiffCompare two texts and highlight differences.
- JSON ValidatorCheck if JSON is valid and find syntax errors.
- Cron Expression GeneratorBuild and explain cron schedules.
- JSON FormatterFormat and beautify JSON online.
- JSON MinifierRemove whitespace to make JSON compact.
