Regex tester
This regex tester runs a JavaScript regular expression against your text and lists what it matches. Developers use it to build and debug patterns for validation, search and replace, and log parsing.
- Runs in your browser
- Free, no account needed
- Copy or download the result
Result
Example
Deadlines: 2026-10-29, 2026-11-05 and 2027-01-15.
Pattern: /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g Matches: 3 1. Index 11, length 10: "2026-10-29" Group 1: "2026" Group 2: "10" Group 3: "29" Named group year: "2026" Named group month: "10" Named group day: "29" 2. Index 23, length 10: "2026-11-05" Group 1: "2026" Group 2: "11" Group 3: "05" Named group year: "2026" Named group month: "11" Named group day: "05" 3. Index 38, length 10: "2027-01-15" Group 1: "2027" Group 2: "01" Group 3: "15" Named group year: "2027" Named group month: "01" Named group day: "15"
How to use the regex tester
- Enter your Pattern without the surrounding slashes, and any Flags such as g or i.
- Paste the text to search into the Test text box.
- Optionally fill in Replacement to preview a replace.
- Press Run, then Copy result or Download.
How it works
Patterns run on the JavaScript regular expression engine in your browser, so lookbehind, named groups and the u and v flags work as they do in JavaScript.
Without the g or y flag only the first match is shown. Each match lists its index (counted in UTF-16 code units), its length, its numbered groups and its named groups.
The replace preview supports $1, $<name>, $&, $`, $' and $$, the same patterns as JavaScript's replace.
Limits: patterns up to 1,000 characters, test text up to 100,000 characters and at most 1,000 listed matches.
Complex patterns with nested repeats, such as (a+)+, can be very slow on some text and may freeze the page.
Everything runs in your browser. Your input is not uploaded or stored.
Questions and answers
Why do I only see one match?
Add the g flag. Without it, JavaScript stops after the first match.
How do I use a named group in the replacement?
Write (?<name>...) in the Pattern and $<name> in Replacement, for example $<day>/$<month>/$<year>.
Does this work for Python or PCRE patterns?
It uses JavaScript rules. Most basic syntax is shared, but other engines support features JavaScript does not, such as possessive quantifiers, so test there too.
Why does the page hang on my pattern?
Some patterns, such as (a+)+$, take exponential time when a match fails. Rewrite nested repeats so each part of the text can be matched in only one way.