Developer utility

Regex Tester

Test JavaScript regular expressions with live matches, numbered and named captures, exact indices, highlighted text and replacement output. Risky matching runs in a timeout-protected browser worker.

Pattern

Build a regular expression

//

Compiled expression

Matches
Groups
Flags
Runtime

Match list

Matches and positions

#MatchStartEndLengthGroups

Capture groups

Numbered and named groups

MatchGroupValueStartEnd

Preview

Highlighted test text

Replace

Test replacement output

Examples

Common regex tests

Regex quick reference

TokenMeaningExample
.Any character except a line terminator unless dotAll is enabled.a.c
\dDecimal digit character.\d{4}
\wASCII letter, digit or underscore in JavaScript regex.\w+
+One or more of the previous token.\w+
*Zero or more of the previous token..*
?Optional token or lazy quantifier marker.https?
()Numbered capture group.(\d{4})-(\d{2})
(?<name>...)Named capture group.(?<year>\d{4})
^ / $Start and end anchors.^Title
\bWord boundary.\bcat\b

JavaScript regular expression notes

JavaScript RegExp flavorSyntax and available flags follow the JavaScript engine in the current browser. The v flag is disabled when Unicode Sets are unsupported.
Timeout protectionMatching and replacement use a disposable Web Worker when available. A long-running pattern is terminated after one second instead of freezing the page.
Scanning semanticsThe tester adds g internally only when needed to list matches and preserves y sticky behavior. Results stop at 1,000 matches.
Replacement semanticsReplacement uses the flags you selected, so without g only the first match is replaced. JavaScript variables such as $1, $&, and $<name> are supported.

Regex tester FAQ

Which regular expression flavor does this tool use?

It uses the native JavaScript RegExp engine in your browser, including supported modern flags and named capture groups.

Can I inspect capture positions?

Yes. Enable the d flag to show start and end indices for numbered and named capture groups.

Why does a pattern time out?

Some expressions cause catastrophic backtracking. The tester stops worker execution after one second to keep the page responsive.

Does the tester send my pattern or text to a server?

No. Compilation, matching, highlighting and replacement happen locally in your browser.