Regular Expression

Test String

Match Results 0 matches

Advertisement Space

728 x 90

Regular Expression Cheatsheet

Character Classes

. Any character except newline
\w Word character [a-zA-Z0-9_]
\d Digit [0-9]
\s Whitespace character
[abc] Any of a, b, or c
[^abc] Not a, b, or c

Quantifiers

* 0 or more
+ 1 or more
? 0 or 1
{3} Exactly 3 times
{3,} 3 or more times
{3,5} Between 3 and 5 times

Anchors & Boundaries

^ Start of string/line
$ End of string/line
\b Word boundary
\B Not word boundary

Groups & Alternation

(abc) Capture group
(?:abc) Non-capturing group
a|b Match a or b

About Regular Expressions

  • Regular expressions are patterns used to match character combinations in strings.
  • Character classes like \w (word), \d (digit), and \s (space) match specific character types.
  • Quantifiers specify how many instances of a character or group must be present for a match.
  • Anchors like ^ (start) and $ (end) specify positions in the string.
  • Flags modify how the search is performed (global, case-insensitive, etc.).
  • This tool works entirely in your browser - your data never leaves your computer.
  • Use the cheatsheet above as a quick reference while building your patterns.