Anchors:
^ Start of string
$ End of string
Character Classes:
\s White space
\S Not white space
\d Digit
\D Not digit
\w Word
\W Not word
\b Word boundary
Quantifiers:
* 0 or more
+ 1 or more
? 0 or 1
{3} exactly 3
{3,} 3 or more
{3,5} 3,4 or 5
Special Characters:
\n New line
\r Carriage return
\t Tab
\ Escape Character
Groups and Ranges:
. Any character except new line
(a|b) a or b
(…) Group
[abc] a or b or c
[^abc] Not a or b or c
[a-q] letter between a and q
[A-Q] Upper case letter between A and Q
[0-7] Digit between 0 and 7
PostGres RegEx:
WHERE table_name ~ ‘^[t]’; — Match
WHERE table_name ~* ‘^[t]’; — Case insensitive match
WHERE table_name ! ‘^[t]’; — No Match