Regex Lab

Regex Lab

Test regular expressions with live matching.

 
Matches
PatternDescription
.Any character except newline
\dDigit (0-9)
\DNot a digit
\wWord character (a-z, A-Z, 0-9, _)
\WNot a word character
\sWhitespace (space, tab, newline)
\SNot whitespace
\bWord boundary
^Start of string (or line with m flag)
$End of string (or line with m flag)
*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n times
{n,m}Between n and m times
[abc]Character class (a, b, or c)
[^abc]Not a, b, or c
(abc)Capture group
(?:abc)Non-capturing group
(?=abc)Lookahead
(?!abc)Negative lookahead
a|ba or b