CalcaTools

Regex Tester and Explainer | Test Matches and Capture Groups

Test JavaScript regular expressions against sample text with live match highlighting, capture-group extraction, and flag controls. Build, debug, and explain patterns in seconds — each match, group, and flag effect is visible instantly as you type.

Last updated: August 2026 · Free · No sign-up required

Test JavaScript regular expressions against sample text, highlight matches, and inspect capture groups locally in your browser.

How this tool works

How regex testing works

The tester creates a JavaScript RegExp from the pattern and flags, applies it to the sample text, and displays match positions and capture groups. Invalid syntax is reported without executing arbitrary code.

Engine scope

Results follow the browser’s JavaScript regular-expression engine. PCRE, Python, .NET, and Rust regex dialects can support different syntax and behavior.

Worked example

Enter representative inputs, review the result, and adjust assumptions to compare scenarios.

Frequently asked questions

What is a regex tester?

A regex tester applies a regular-expression pattern to sample text and shows whether and where matches occur.

What do regex flags do?

Flags change matching behavior. For example, g finds multiple matches, i ignores case, and m changes line-anchor behavior in JavaScript.

What is a capture group?

A capture group is a parenthesized part of a pattern whose matched text is returned separately from the full match.

Why does my regex not match?

Check escaping, capitalization, whitespace, anchors, flags, and the regex dialect expected by your target programming language.

Which regex engine does this use?

It uses the browser’s JavaScript RegExp engine, which can differ from PCRE, Python, .NET, or other engines.

Is my sample text uploaded?

The tester is designed to run matching in the browser. Avoid entering confidential data into any online tool and use local tooling for sensitive samples.

Quick reference

PatternMeaningMatches
d{3}Exactly 3 digits123, 456
[A-Za-z]+One or more lettersabc, Word
sWhitespacespace, tab
^...$Start / end anchorswhole-string match
(a|b)Alternation (a or b)cat, bat

code Live explainer

Every token decoded.

science Test harness

Try the pattern on real text.

lightbulb Pro tip

Anchor first, match later.

lightbulb Worked example

Extracting dates in YYYY-MM-DD format from a log file line.

Result: One match, three capture groups: year, month, day.

Formula & methodology

Formula: a match exists when the regular-expression engine finds a substring satisfying the pattern and selected flags

How regex testing works

The tester creates a JavaScript RegExp from the pattern and flags, applies it to the sample text, and displays match positions and capture groups. Invalid syntax is reported without executing arbitrary code.

Engine scope

Results follow the browser’s JavaScript regular-expression engine. PCRE, Python, .NET, and Rust regex dialects can support different syntax and behavior.

Authoritative source: MDN JavaScript RegExp reference

Explore the full everyday toolkit

Every CalcaTools everyday calculator — dates, time, age, measurements, home projects, and lifestyle tools — ready when you need a quick answer.