Quick answer
A regular expression is a pattern for finding and extracting text. Type a pattern above, toggle flags like g (all matches) and i (ignore case), and paste text to see matches highlighted with their capture groups. It uses your browser's native JavaScript RegExp engine, so results match Node.js and TypeScript exactly, and nothing you type leaves your device.
How to read the results
- Highlighted matches shows your test string with every match wrapped in a highlight, so you can see at a glance what the pattern catches and what it misses.
- Match details lists each match, its position in the string, and any capture groups. Numbered groups (
$1,$2) come from plain parentheses; named groups appear as<name>. - Status line confirms how many matches were found, or shows the exact syntax error if the pattern is invalid.
Flags explained
Flags change how the whole pattern behaves. The two you'll reach for most are g and i:
g— global: return every match, not just the first. Without it, most languages stop at the first hit.i— ignore case:catmatchesCatandCAT.m— multiline:^and$match at the start and end of each line, not just the whole string.s— dotAll: the.also matches newline characters, which it normally doesn't.u— unicode: enables full Unicode handling and\p{...}property escapes.y— sticky: each match must start exactly at the current position, useful for tokenizers.
Syntax cheat sheet
| Token | Matches |
|---|---|
. | Any character except newline (unless s flag) |
\d \w \s | Digit, word character, whitespace |
\D \W \S | The negation of each (non-digit, etc.) |
[abc] [^abc] | Any one of a/b/c; or any character except them |
[a-z0-9] | A character range |
* + ? | 0+, 1+, or 0-or-1 of the preceding token |
{2} {2,} {2,5} | Exactly, at-least, or between-n-and-m repetitions |
^ $ | Start / end of string (or line with m) |
\b | Word boundary |
(abc) (?:abc) | Capturing group / non-capturing group |
(?<name>abc) | Named capture group |
a|b | Alternation: a or b |
(?=abc) (?!abc) | Lookahead / negative lookahead |
Remember to escape characters that have special meaning when you want them literally — ., (, ), [, ], {, }, *, +, ?, |, ^, $, and \ — by putting a backslash in front. A literal dot is \., as used in the email example above.
Frequently Asked Questions
What regex flavor does this tester use?
It uses the browser's native JavaScript (ECMAScript) RegExp engine, so what you see here matches exactly how the pattern behaves in JavaScript, Node.js, and TypeScript. Most core syntax is shared with other flavors, but features like lookbehind, named groups, and Unicode property escapes follow the JavaScript specification.
What do the g, i, m, s, u, and y flags do?
g (global) finds all matches instead of just the first; i (ignore case) makes matching case-insensitive; m (multiline) makes ^ and $ match at line breaks; s (dotAll) makes the dot match newlines; u (unicode) enables full Unicode and property escapes; y (sticky) anchors each match at lastIndex. Toggle them with the checkboxes and the results update live.
How do I capture part of a match?
Wrap the part you want in parentheses to create a capture group; it appears as $1, $2, and so on under each match. Use (?<name>...) for a named group, which shows up by name. Use (?:...) for a non-capturing group when you need grouping without capturing.
Is my test text sent to a server?
No. Both the pattern and the test text are evaluated entirely in your browser using the native RegExp engine. Nothing is uploaded, so it is safe to test against real logs or data, and the tool works offline.
Why does my pattern match nothing or throw an error?
If the pattern is invalid — for example an unclosed group or bracket — the status line shows the exact syntax error. If it is valid but matches nothing, check whether you need the g flag for multiple matches, the i flag for case, or the m flag for anchors to work per line. Remember to escape literal special characters like . ( ) [ ] with a backslash.