Dev Toys

Regex Tester

Test a regular expression with live matches and groups

//gm
Test string
Matches (0)
Replace
Syntax cheat sheet
[abc]Any one character listed
[^abc]Any character not listed
.Any character except a newline
\d \w \sDigit, word character, whitespace; uppercase negates
^ $Start / end of text (with m: of each line)
\b \BWord boundary / not a boundary
* + ?0+, 1+, optional; add ? for lazy
{n} {n,m}Exactly n / between n and m
(...)Capturing group; $1 in the replacement
(?:...)Group without capturing
(?<name>...)Named group; $<name> in the replacement
a|bEither side
\1Same text as group n
(?=...) (?!...)Followed by / not followed by
(?<=...) (?<!...)Preceded by / not preceded by
\.Literal character that is otherwise special