Regular Expression
Flags:
/
/gm
Test String
Highlighted Matches & Capture Groups
Full Match
Group 1
Group 2
Detailed Match Inspector
| # | Full Match | Range | Groups |
|---|
Instant Regular Expression Cheat Sheet
Quick syntax reference for JavaScript, Python, PCRE, and POSIX regular expressions.
Character Classes
.Any character except newline
\dAny digit [0-9]
\DNon-digit [^0-9]
\wWord char [a-zA-Z0-9_]
\WNon-word character
\sWhitespace (space, tab, newline)
[abc]Any character in brackets
[^abc]Any character not in brackets
Quantifiers
*0 or more (greedy)
+1 or more (greedy)
?0 or 1 (optional)
{3}Exactly 3 times
{2,5}Between 2 and 5 times
{2,}2 or more times
*?0 or more (lazy / non-greedy)
+?1 or more (lazy / non-greedy)
Anchors & Boundaries
^Start of string / line
$End of string / line
\bWord boundary
\BNon-word boundary
A|BAlternation (matches A or B)
Groups & Lookaround
(abc)Capturing group
(?:abc)Non-capturing group
(?=abc)Positive lookahead
(?!abc)Negative lookahead
(?<=abc)Positive lookbehind
(?<!abc)Negative lookbehind