Solved: 0 / 0

Regex Cheatsheet
Literal Characters
a Matches the exact character "a"
123 Matches the exact case-sensitive sequence "123"
HeLLo Matches the exact case-sensitive sequence "HeLLo"
\. Escaped dot — matches a literal "." character
. Unescaped dot — matches any character (except newline)
Character Classes
[abc] A single character of: a, b, or c
[^abc] Any character except: a, b, or c
[a-z] Any character in range a–z
[^a-z] Any character not in range a–z
\s Whitespace (space, \t, \n, \r, \f)
\S Not whitespace — same as [^\s]
\d Digit (0–9) — same as [0-9]
\D Not digit — same as [^0-9]
\w Word character — same as [a-zA-Z_0-9]
\W Not word character — same as [^a-zA-Z_0-9]
Quantifiers (Greedy)
a* 0 or more
a+ 1 or more
a? 0 or 1 (optional)
a{n} Exactly n times
a{n,} n or more times
a{m,n} Between m and n times
Quantifiers (Lazy)
a*? 0 or more, as few as possible
a+? 1 or more, as few as possible
Anchors & Boundaries
^ Start of string/line
$ End of string/line
\b Word boundary (between \w and \W)
\B Not a word boundary
Groups & Alternation
(...) Group — treat as a single unit; captures by index
(a|b) Alternation — matches either a or b
(?P<name>...) Named group — access by name, not number
(?:...) Non-capturing group — groups without storing
\1 Backreference to capture group 1
Lookarounds
(?=...) Positive lookahead
(?!...) Negative lookahead
(?<=...) Positive lookbehind
(?<!...) Negative lookbehind
Click 'Random Unsolved Problem' or choose one from the bank to start
^
$

Debugger