Developer
Regex tester
Test JavaScript regular expressions with live matches, groups, and replacements.
Free to use · Runs in your browser · No signup
This tool works in your browser. Enable JavaScript to select files and create your download.
How to use Regex tester
- Enter a regular expression and its flags.
- Paste test text and review each match, its position, and capture groups.
- Optionally enter a replacement to preview the result.
What you need
Nothing to upload. Type or paste directly into the tool; results update as you go.
Your result
Matches, capture groups, and an optional replacement preview.
Before you start
Uses the JavaScript regex engine in your browser. Patterns that take too long are stopped automatically to protect the page.
JavaScript regular expressions
Patterns run with your browser’s JavaScript (ECMAScript) engine, the same one used by Node.js and front-end code. Named groups (?<name>…), lookahead, lookbehind, and Unicode property escapes like \p{L} (with the u flag) are supported.
- Not supported in JavaScript: possessive quantifiers (a++), atomic groups (?>…), \A and \Z anchors, and inline modifiers like (?i). Patterns copied from PCRE, PHP, or Python may need adjusting.
Flags
- g: find all matches (the match table always lists every match; g also controls whether replacement changes all matches or only the first).
- i: ignore case · m: ^ and $ match at line breaks · s: . also matches newlines.
- u and v: Unicode mode · y: sticky · d: record match indices.
Protection from runaway patterns
Patterns run in a background worker and are stopped after 1.5 seconds. Nested quantifiers like (a+)+ can take exponential time on some inputs (“catastrophic backtracking”); if a pattern is stopped, simplify those parts.
Example
Pattern: (?<user>[\w.]+)@(?<domain>[\w-]+\.\w+)
Flags: gi
Text: Contact ada@example.com or grace.h@navy.mil
Replace with: $<user> at $<domain>
Result: Contact ada at example.com or grace.h at navy.milQuestions about Regex tester
How do I use capture groups in the replacement?
Use $1, $2… for numbered groups and $<name> for named groups. $& inserts the whole match.
Why does my pattern from Python or PHP fail?
Those engines support features JavaScript doesn’t, such as possessive quantifiers and atomic groups. Rewrite those parts or test them in their original language.
How many matches are shown?
The first 1,000 matches are listed in the table; the total count includes all of them.
Is what I type sent anywhere?
No. The calculation runs in your browser, and the text or numbers you enter are not uploaded or stored.
Is it free? Do I need an account?
Yes, it’s free, and there’s no account or signup. FreeToolBench is supported by ads.