Regex Tester & Explainer
Type a regular expression, pick your flags, paste some text, and see exactly what matches. The tester counts every non-overlapping match, highlights them inline, and lists the capture groups for each one. The built-in Explainer turns your pattern into plain English, piece by piece. Everything runs locally in your browser — no network, no uploads — so you can experiment freely with sensitive text.
How To Use
- Enter a regular expression in the Pattern field, for example
\d{4}-\d{2}-\d{2}. - Tick the flags you need:
gfor all matches,ito ignore case,mfor multiline anchors, andsso.matches newlines too. - Paste your Test text into the textarea.
- Click Test to see the match count, highlighted matches, and the capture groups for each match.
- Click Explain for a plain-language breakdown of every piece of your pattern.
- Click Copy matches to put a plain-text summary on your clipboard.
Usage Example
Say your pattern is (\d{2})/(\d{2})/(\d{4}) and your test
text is:
Orders ship on 14/03/2026 and 02/09/2026.
Clicking Test reports 2 matches. Both
dates are highlighted, and the capture groups for the first match are
group 0: 14/03/2026, group 1: 14,
group 2: 03, and group 3: 2026 — the day,
month, and year you wrapped in parentheses. Then click
Explain and every token is decoded: two digits,
a slash, two digits, a slash, and four digits.
Frequently Asked Questions
What is a regular expression (regex)?
A regular expression is a compact pattern language used to describe and match text. Instead of searching for one fixed string, you describe a shape: for example \d{4} means "exactly four digits" and [a-z]+ means "one or more lowercase letters". Regex powers validation, searching, and text extraction in almost every programming language, and this tester lets you experiment with them instantly.
Does the Explainer understand every regex syntax?
No. The Explainer covers a deliberately bounded subset: literal characters, the dot, the shorthand classes \d \w \s \b (and their uppercase negations), character classes such as [abc] and [^…], capturing and non-capturing groups, the quantifiers + * ? {n} {n,} {n,m}, the anchors ^ $, and the alternation |. More advanced constructs — lookahead, lookbehind, named groups, and Unicode properties — are marked [not explained] in the output so you always know exactly what was decoded and what wasn't. The tester itself still matches them correctly; only the textual explanation is limited.
Which flags are supported?
The tool exposes the four most useful JavaScript regex flags: g (global — find every match instead of stopping at one), i (case-insensitive matching), m (multiline, so ^ and $ match line starts and ends), and s (dotall, letting the dot match newline characters).
Why is there no network involved?
Matching and explanation happen entirely in your browser with native JavaScript — nothing is sent to a server and nothing is uploaded anywhere. That makes the tool fast, private, and safe to use with sensitive or proprietary text that you would never want leaving your machine.
What does the g flag do?
Without g, many engines stop after the first match. With g (global), the tester scans the whole subject and counts every non-overlapping match, then highlights all of them. For counting and highlighting every occurrence, you will normally want g enabled.
How do I read the capture groups?
Parentheses in a pattern create capture groups. In the output, group 0 is always the entire match, and group 1, group 2, and so on are each parenthesized part in order. For example in (\d{2})-(\d{2}) against 12-34, group 1 is 12 and group 2 is 34. A group that did not participate in a match is shown as (no match).