Regex Tester
- Free forever
- No sign-up
- Runs in your browser
Test JavaScript regular expressions live: see every match highlighted, the capture groups, and a replace preview.
Cheat sheet (click to insert)
\d digit\w letter, digit or _\s space, tab or newline. any character[abc] a, b or c[^abc] not a, b or c^ start of line$ end of line* 0 or more+ 1 or more? optional{2,5} 2 to 5 times(…) group(?<name>…) named groupa|b a or b\b word boundaryAbout Regex Tester
A scratchpad for building and debugging regular expressions against real text. Matches are highlighted as you type, a table lists each match with its position and capture groups, including named ones, and a replace box previews the result with $1, $2 or $<name>. A clickable cheat sheet inserts common tokens, and pasting a pattern in /pattern/flags form ticks the right flags. It suits validation rules, log searches and find-and-replace jobs.
How to use Regex Tester
- Type your pattern in the Pattern box, or paste it as /pattern/flags and the flags are set for you.
- Tick the flags you need, such as g for all matches or i to ignore case.
- Paste sample text into Test text and see every match highlighted, with positions and capture groups.
- Type a Replace with value using $1, $2 and so on, then click Copy result.
How your data is handled
Patterns and test text are processed by your browser's own regex engine, with no extra downloads. Nothing you type is uploaded or stored.
Limits and accuracy
- PCRE features such as possessive quantifiers, atomic groups and recursion aren't available in JavaScript regex.
- Only the g, i, m, s and u flags can be set; y, d and v are ignored if you paste them.
- Without the g flag, the replace preview changes only the first match, just like JavaScript's replace().
Questions and answers
Which regex flavour does it use?
It uses JavaScript's built-in regular expressions, the same engine as your browser and Node.js. Python, PHP and Java share most of the syntax, but some features differ, so test the final pattern in your own language too.
Why does my pattern only find one match?
The g flag is off. Tick g to find every match; without it, the search stops at the first one. Tick m as well if ^ and $ should match at the start and end of each line.
How do I use capture groups in the replacement?
Wrap part of the pattern in round brackets, then use $1 for the first group, $2 for the second and so on in Replace with. Named groups work too. The Result box updates as you type.
Does it support lookbehind and named groups?
Yes. Anything your browser's JavaScript engine supports works, including lookahead, lookbehind, named groups like (?<year>\d{4}) and Unicode property escapes such as \p{L} with the u flag. Current versions of the main browsers support all of these.
Why does the page freeze with some patterns?
Nested repeats such as (a+)+ can make the engine try a huge number of combinations on text that doesn't quite match. Matching runs in the page with no time limit, so simplify the pattern or make the repeated part more specific.
How many matches can it show?
It counts up to 5,000 matches, and the table lists the first 200 with their positions and groups. All counted matches are highlighted in the Matches box.
Do I need to sign up?
No. Regex Tester is free with no sign-up, no login and no daily limit, and there's nothing to install. It works on a phone as well as a PC.
Is my text sent to a server?
No. Regex Tester runs in your browser, so what you paste stays on your device. That makes it safe for passwords, tokens, customer data and anything else private.
Which regex flavour is this?
JavaScript, the same engine as browsers and Node. Most patterns work the same in Python, Java and C#, but lookbehind and some escapes differ, so test in your own language before shipping.
Can I test capture groups and replace?
Yes. Matches show each group, and the Replace box accepts $1, $2 and so on to rewrite the text.