Regex Tester Online — JavaScript Match & Replace

JavaScript regex workshop: set the pattern and test string, click Test for inline highlights and match cards with groups, or preview replace — all client-side, no upload.

Loading…
Regex tester — developer notes
JavaScript RegExp workshop: flags, cheat-sheet chips, inline highlights on the test string, and match cards with capture groups. Preview replace with $1 / $& — all client-side.

How testing works

Enter a pattern and test string, toggle flags (g/i/m/s/u/y), then click Test (or use an example / Sample). Matches update when you run the test — not while typing. The left pane highlights hits; the right pane lists match cards with 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. Sticky (y) matches only at the start of the test string here because lastIndex is reset on every run.
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 + test string

(\w+)=(\d+) on user=42 role=admin env=prod (flag g)

Result

1 match: user=42 → groups [user, 42] (other pairs need non-digit values — try the digits example)

Replace with $1

Pattern + test string

(\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). There is no flavour switch.

Do I need to include / delimiters?

Don’t include / delimiters in the pattern field — or paste /pattern/flags and we’ll unwrap the pattern and merge flags automatically.

How does sticky (y) work here?

Sticky (y) matches only at the start of the test string here because lastIndex is reset on every run.

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. Very large match sets may be truncated.

Is the email example a full RFC validator?

No — the email-ish example is a practical pattern for demos, not a complete RFC 5322 validator.

Are named groups supported?

Yes. Named captures appear once as GROUP k (name) on each match card — not duplicated as a separate numbered row.

Is my text uploaded?

Never — testing stays in your browser.

Timestamps, UUID, ULID, Nanoid, cron, passwords, regex, slugify, number bases, case, text diff, and chmod — all client-side.