Dev

Regex Tester

Type a pattern and a test string — matches, groups and replacements update as you type. Cheat sheet included.

Enter a pattern and a test string
Pattern & test string —
or drop a file here
Mode
Matches —
Matches will be highlighted here
How It Works

How to Use Regex Tester in 3 Steps

1

Write the pattern

Type a JavaScript regular expression between the slashes and tick the flags you need (g finds every match, i ignores case, m makes ^ and $ work per line). Click any token in the cheat sheet below to insert it.

2

Paste a test string

Matches light up in the text as you type, and each one is listed with its position, numbered groups and named groups. An invalid pattern shows the exact syntax error under the input.

3

Replace or export

Switch to Replace to preview a substitution — $1, $<name> and $& work as in JavaScript. Copy the result, or download the match list as text or JSON.

Reference

Regex Cheat Sheet — click to insert

Characters

Quantifiers

Anchors

Groups

Lookaround

Common patterns

FAQ

Regex Tester — Frequently Asked Questions

Which regex flavour is this?

JavaScript (ECMAScript), exactly as your browser runs it — the same engine Node.js, React and every web page use. Named groups, lookbehind, Unicode property escapes (with the u flag) and the s flag are all supported. PCRE-only syntax such as possessive quantifiers or \A is not.

Why does it say “pattern took more than 1.5 s”?

Patterns with nested quantifiers like (a+)+$ can backtrack exponentially on the wrong input. Matching runs in a background thread with a time limit, so the page stays responsive and tells you instead of freezing. Make the inner quantifier possessive-style by using a character class, or anchor the pattern.

How do capture groups show up?

Each match lists its numbered groups (1, 2, …) and named groups ((?<year>\d{4}) appears as year). In Replace mode use $1 or $<year> to reuse them.

Is there a limit on text size or matches?

The test string can be up to 50 MB if you open a file, but highlighting is drawn for the first 200,000 characters and the first 2,000 matches so the page stays fast. The badge tells you when either limit kicks in; the match count and Replace output are still complete.

Why does my pattern match nothing with the y flag?

Sticky (y) only tries to match at the current position (0 to begin with), so it behaves like an anchored search. Untick it unless you specifically need that behaviour.

Is my code uploaded anywhere?

No. Formatting and minifying run in JavaScript inside your browser tab. The formatter libraries are downloaded once from a CDN; your code never leaves the page.