Regex Tester

Test JavaScript regular expressions with live highlighting, capture groups and a replace preview. Nothing leaves your browser.

Flags

Matches 0

Match details

Replace


                
Cheat sheet
.Any character except newline (all with s)
\d \w \sDigit, word character, whitespace
\D \W \SNot digit / word / whitespace
[abc] [^abc]Any of / none of a, b, c
[a-z]Character range
^ $Start / end of input (of line with m)
\b \BWord boundary / not a boundary
* + ?0 or more, 1 or more, 0 or 1
{3} {2,5} {2,}Exactly 3, 2 to 5, 2 or more
*? +?Lazy (as few as possible)
(โ€ฆ) (?:โ€ฆ)Capture group / non-capturing group
(?<name>โ€ฆ)Named group, reference with \k<name>
a|ba or b
(?=โ€ฆ) (?!โ€ฆ)Lookahead / negative lookahead
(?<=โ€ฆ) (?<!โ€ฆ)Lookbehind / negative lookbehind
\p{L}Unicode property (needs u)

Uses your browser's JavaScript regex engine. Matching runs in a background worker and is stopped after 1 second, so runaway patterns like (a+)+$ can't freeze the page.

โ†‘โ†“ to move ยท Enter to open ยท Esc to close