Regex Tester
Regex Tester runs JavaScript regular expressions in your browser, highlighting every match with its numbered and named groups, plus replace and split previews.
Checks the shape only: 2026-02-31 matches even though February has no 31st. Parse the result with a date library to validate it.
Cheat sheet
| . | Any character except line breaks (all of them with s) |
| \d \w \s | Digit, word character [A-Za-z0-9_], whitespace |
| \D \W \S | Anything except those |
| [abc] [^abc] [a-z] | One of, none of, a range |
| ^ $ | Start and end of the text (of each line with m) |
| \b | Word boundary |
| * + ? {2,5} | Repeat 0+, 1+, 0 or 1, 2 to 5 times; add ? for lazy |
| (x) (?:x) (?<name>x) | Capture, group without capturing, named capture |
| \1 \k<name> | Backreference to a group |
| a|b | Either side |
| (?=x) (?!x) | Followed by x, not followed by x |
| (?<=x) (?<!x) | Preceded by x, not preceded by x |
| \p{L} \p{Lu} | Unicode letter, uppercase letter (needs u or v) |
| $1 $2 | Numbered group |
| $<name> | Named group |
| $& | The whole match |
| $` $' | Text before / after the match |
| $$ | A literal $ |
At a glance
- Accepts
- A JavaScript (ECMAScript) pattern with flags g, i, m, s, u, y, d and v where supported, and any test text
- Outputs
- Highlighted matches, each with index and capture groups, a replace preview with $1 / $<name>, and the split result
- Where it runs
- Entirely in your browser, on your device
- What leaves your device
- Nothing - what you type stays in this tab
- Limits
- JavaScript syntax only, not PCRE; matching stops after 1 second; the first 1,000 matches are highlighted and 200 listed
- Account
- Not required - there is no sign-up
- Price
- Free, with no watermark and no usage cap
- Made by
- Visrut
- Last updated
- 13 October 2026
Regex Tester checks a JavaScript regular expression against your text as you type. Every match is highlighted in place and listed with its position and capture groups, numbered and named. Switch to Replace to preview a replacement string with $1 or $<name>, or to Split to see what text.split(regex) returns. Matching happens in a background worker with a 1-second limit, so a pattern with runaway backtracking shows a warning instead of locking up the page.
How to use it
- Type the pattern without the surrounding slashes, and switch on the flags you need.
- Paste or type the text to test it against.
- Read the highlighted matches and the group values below, or open Replace or Split to preview those operations.
JavaScript regex, not PCRE
The syntax and flags follow JavaScript's RegExp as documented on MDN (regular expressions guide, flags, replacement patterns, checked 13 October 2026). A pattern that works here works the same way in JavaScript running on the same engine; in PHP, Python, Java or grep, check that language's rules, especially for lookbehind, Unicode classes and inline flags.
Frequently asked questions
Which regex flavour does it use?
JavaScript (ECMAScript), run by your own browser's RegExp engine, so results match what the pattern does in JavaScript code running on the same engine. It is not PCRE: patterns written for PHP, grep -P or many online PCRE testers can behave differently or fail to compile.
What PCRE features are missing in JavaScript?
No possessive quantifiers (a++), no atomic groups (?>...), no recursion (?R), no \A or \Z anchors (use ^ and $ without the m flag), and no (?i)-style mode switch at the start of a pattern. Use the flag buttons instead.
Is my text sent anywhere?
No. The pattern and test text are matched in a Web Worker inside your browser. Nothing you type is uploaded, stored or included in analytics.
Why does it say my pattern is too slow?
Matching runs in a background worker with a 1-second limit. Patterns with nested or overlapping quantifiers, like ^(a+)+$ on a long run of a's followed by a character that can't match, can take exponentially long as the engine backtracks. Instead of freezing the tab, the worker is stopped and you see the warning. The same pattern would hang real code too, so it's worth rewriting.
How do I use capture groups in the replacement?
$1, $2 and so on insert numbered groups, $<name> inserts a named group, $& the whole match, $` and $' the text before and after it, and $$ a literal dollar sign. Without the g flag only the first match is replaced, exactly as String.prototype.replace does.
Which flags are available?
g, i, m, s, u, y, plus d (match indices) and v (Unicode sets) where your browser supports them. Flags your browser doesn't support are greyed out. u and v can't be used together, so turning one on turns the other off.