Test regex patterns in real time. See match highlights, capture groups, indices, and test replacements — all in your browser.
| Token | Meaning | Token | Meaning |
|---|---|---|---|
. | Any char except newline | \d | Digit [0–9] |
^ | Start of string / line (m) | \D | Non-digit |
$ | End of string / line (m) | \w | Word char [a-zA-Z0-9_] |
* | 0 or more (greedy) | \W | Non-word char |
+ | 1 or more (greedy) | \s | Whitespace |
? | 0 or 1 (or lazy quantifier) | \S | Non-whitespace |
{n,m} | Between n and m times | \b | Word boundary |
[abc] | Character class | \B | Non-word boundary |
[^abc] | Negated character class | (?:…) | Non-capturing group |
(abc) | Capturing group | (?=…) | Positive lookahead |
a|b | Alternation (a or b) | (?!…) | Negative lookahead |
(?<name>…) | Named capture group | \1, \2 | Back-reference |
RegExp engine — the same engine that runs in every browser and Node.js. It supports all ECMAScript 2024 regex features including named capture groups ((?<name>…)), lookaheads, lookbehinds, Unicode property escapes (\p{L} with the u flag), and the d flag for match indices. Most patterns from PCRE and Python re work here, with minor syntax differences.abc matches "ABC", "Abc", etc. m (multiline) — ^ and $ match the start/end of each line, not just the whole string. s (dotAll) — makes . match newline characters too. u (unicode) — treat the pattern as a sequence of Unicode code points and enable Unicode property escapes like \p{Emoji}.$1, $2… to reference numbered capture groups. Use $<name> for named groups. Use $& to insert the full matched string, and $$ for a literal dollar sign. For example, if your pattern is (\w+)\s(\w+) (first and last name), the replacement $2, $1 would reorder them to "Last, First".. matches any character, not a literal dot. Use \. for a literal dot. (2) Using + or * greedily when you want lazy — add ? after: .*? matches as few characters as possible. (3) Anchors — without ^ and $, your pattern can match anywhere inside a string. (4) The g flag — without it, only the first match is returned.