Skip to content
cnu.name

Regex Tester

Test regular expressions with live highlighting

/ /

Match Info

Enter a pattern and test string to see matches

Quick Reference

Character Classes
.Any character (except newline)
\dDigit [0-9]
\DNot a digit
\wWord char [a-zA-Z0-9_]
\WNot a word char
\sWhitespace
\SNot whitespace
[abc]Any of a, b, or c
[^abc]Not a, b, or c
[a-z]Range a to z
Quantifiers
*0 or more
+1 or more
?0 or 1
{n}Exactly n
{n,}n or more
{n,m}Between n and m
*?Lazy (minimal match)
Anchors & Boundaries
^Start of string/line
$End of string/line
\bWord boundary
\BNot a word boundary
Groups & Lookaround
(abc)Capture group
(?:abc)Non-capturing group
(?<name>abc)Named capture group
\1Backreference
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind
Flags
gGlobal — find all matches
iCase insensitive
mMultiline (^ and $ per line)
sDotall (. matches newlines)
uUnicode support