Building Blocks
-
\d a digit
-
\D a non-digit
-
\s a whitespace
-
\S a non-whitespace
-
\w a word
-
\W a non-word
-
\b a word boundary
-
. any character
-
\ Escape special char or start a sequence
Repeated Characters or Patterns
-
? 0 or 1 time
-
+ 0 or more times
-
* 1 or more times
-
{#} # of times
-
{#,} # or more times
-
{,#} 0 to # times
-
{#, #} # to # of times
Specific Possible Characters
-
[xyz] either x, y or z
-
[^xyz] Any character besides x, y, or z
-
[a-zA-Z] ranges of characters
Location of Characters
-
^ beginning of line
-
$ end of line
-
\A beginning of string
-
\z end of string
Capturing
-
(...) capture the pattern enclosed
-
(...|...) capture either pattern enclosed