Regex Tester Online
Build and debug JavaScript regular expressions interactively. Type a pattern, toggle the g, i, m, s, u and y flags, and watch matches and capture groups highlight in your test text as you type. You can also preview a replacement using $1, $2 and other references, or start from common patterns such as email, URL, IPv4, UUID or ISO date.
How to use
- Enter a regular expression in the Pattern field, or choose one from Common patterns.
- Toggle the flags you need, such as g (global), i (ignore case) or m (multiline).
- Paste your test text and review the highlighted matches and the list of capture groups.
- Optionally enter a replacement string to see the replaced output, then copy it.
Example
Input
Pattern: (\w+)@(\w+\.\w+) Flags: g
Test text: Contact ada@example.com or bob@test.org
Replacement: [$1 at $2]Output
2 matches
Match 1: ada@example.com ($1 = ada, $2 = example.com)
Match 2: bob@test.org ($1 = bob, $2 = test.org)
Replaced: Contact [ada at example.com] or [bob at test.org]Frequently asked questions
Which regex flavour does this tester use?
It uses the JavaScript RegExp engine, so the syntax and behaviour match what runs in browsers and Node.js. Features from other flavours, such as possessive quantifiers from PCRE, are not supported.
How do I reference capture groups in the replacement?
Use $1 to $9 for numbered groups, $& for the whole match and $$ for a literal dollar sign.
Why do I see only one match?
Without the g (global) flag, JavaScript stops after the first match. Turn on g to find every match in the text.
Is my test text uploaded?
No. All matching and replacement runs locally in your browser.