Regex Tester Online — JavaScript Match & Replace

Test JavaScript regular expressions against sample text. Toggle flags, inspect capture groups, and preview replacements — everything runs locally in your browser.

Loading…
Regex tester — developer notes
Debug JavaScript RegExp against live subject text. Inspect matches, numbered groups, and named groups; preview replace with $1 / $& templates.

How testing works

Enter a pattern and subject, toggle flags (g/i/m/s/u/y), then Test. Match mode lists each hit with index and groups. Replace mode also shows the substituted string. Pathological patterns can freeze the tab — keep experiments local and avoid nested quantifiers on large subjects.

Options

Flags (g / i / m / s / u / y)
Standard JavaScript RegExp flags. Global (g) finds all matches; ignoreCase (i), multiline (m), dotAll (s), unicode (u), and sticky (y) change matching semantics.
Mode (match / replace)
Match lists hits only. Replace applies a substitution string with $1, $&, and related templates so you can preview rewrites.
Replace with
Shown when mode is replace. Supports JavaScript replacement patterns such as $1 for group 1 and $& for the full match.

Examples

Capture pairs

Pattern + subject

(\w+)=(\d+) on a=1 b=2 (flag g)

Result

matches: a=1 → groups [a,1]; b=2 → groups [b,2]

Replace with $1

Pattern + subject

(\d+) → [$1] on x=10 (flag g)

Result

x=[10]

Related utilities

Need URL-safe labels? Use slugify. Generate secrets with the password generator.

Regex tester FAQ

Pattern debugging questions

Is this PCRE or Python regex?

No — this tool uses the browser’s JavaScript RegExp engine only (same flavor as in Node and modern browsers).

Can a pattern freeze my browser?

Yes. Catastrophic backtracking (ReDoS-style patterns) can hang the tab because execution is local. Prefer simple patterns and smaller subjects when experimenting.

Are named groups supported?

Yes, when the engine returns them — they appear next to numbered groups in the match list.

Is my text uploaded?

Never — testing stays in your browser.

Looking for converters, encoders, formatters, and minifiers in one place? Developer tools hub Open the curated developer tools catalogue.