This page compiles a JavaScript RegExp from the pattern field and runs it against the test string in your browser. Matches are highlighted, numbered, and listed with start index, length, numbered groups ($1…), and named groups when the pattern uses (?<name>…).
Results follow ECMAScript regular expressions, the same dialect as new RegExp(pattern, flags) in Chrome, Firefox, Safari, and Edge. Lookaheads, named groups, and Unicode property escapes (with the u flag) behave as they would in front-end JavaScript.
They will not match PCRE, Python re, or POSIX EREs. Tokens such as possessive quantifiers, \A/\Z, or (?i) inline flags are syntax errors here. If a pattern will live in PHP or Python, this tester is a rehearsal for the JavaScript subset only.
Flags on this page
There is no sticky y flag. The highlighter internally walks with RegExp.exec and stops after 5,000 hits so a pattern like a* cannot freeze the tab. Match cards stop at 50; remaining hits still count in the status line.
g — global. Copy Pattern includes this flag so your own String.prototype.match returns every hit, not only the first.
i — ignore ASCII letter case.
m — ^ and $ also match line boundaries, not only the start and end of the whole string.
s — dot-all, so . matches newline.
u — Unicode mode (required for \p{…} and astral characters).
Running a test
- Type a pattern between the slash delimiters (the slashes are decoration, not part of the pattern).
- Paste sample text in Test String.
- Toggle flags on the right of the pattern field.
- Wait ~220ms for the live run, or click Test / press Ctrl+Enter.
- Use Presets for starter patterns, the cheatsheet to insert tokens, Copy for
/pattern/flags, and Clear to reset both fields.
A small original example
Pattern (?<id>NX-\d{4}) with flag g against the string Ticket NX-1042 closed; NX-2210 still open should produce two matches, each exposing named group id. If you forget to escape the hyphen inside a character class, or write \d{4 without the closing brace, the status line shows the engine’s syntax error instead of empty matches.
Input → matches
Test string
Ticket NX-1042 closed; NX-2210 still open
What you should see
2 matches
$1 / named id: NX-1042 at index 7
$1 / named id: NX-2210 at index 29
Mistakes this UI makes obvious
- Double-escaping: in this box write
\d, not the extra backslashes you need inside a JavaScript string literal.
- Greedy
.* swallowing too much; try .*? or a negated class.
- Anchors that fail because the sample has a trailing newline and
m is off.
- Zero-length matches (empty groups). The runner advances
lastIndex by one to avoid an infinite loop.
Where the text stays
Pattern and sample never leave the tab. Theme preference is stored in sessionStorage under a lab key. No regex is compiled on our servers.
JavaScript regex questions
Which regex dialect is this?
The browser’s JavaScript RegExp engine. Possessive quantifiers, \A, and inline (?i) flags from PCRE will error here.
Why do I still see many matches with g off?
The highlighter walks with exec and may list many hits (up to 5,000, 50 cards). Turn g on when you copy /pattern/flags so your own match() returns every hit.
Is there a sticky y flag?
No. Only g, i, m, s, and u are toggles.
Does the pattern leave my browser?
No. It is compiled in this tab.
How do I insert a starter pattern?
Open Presets (email, URL, IPv4, and others) or the cheatsheet tokens, then edit.
After the pattern works
Use Text Compare to diff two log excerpts, or JSON Formatter if the capture is a payload:
Text Compare, JSON Formatter, URL Encoder / Decoder. Browse the full Developer set or the all tools hub.