/ expression / flags
, i.e/[A-Z]+/g
basic format/ hello\?\*\\/
escape special characters with backslashes()
group with parentheses|
logical OR
\w
word\d
digit\s
whitespace (tabs, line breaks)\W
NOT word\D
NOT digit\S
NOT whitespace\t
tabs,\n
line breaks.
any character (except newline)
[xyz]
match any x, y, z[J-Z]
match any capital letters between J & Z.[^xyz]
NOT x, y, z
bob|alice
match bob or alicez?
zero or one occurrencesz*
zero or multiple occurrencesz+
one or multiple occurrencesz{n}
n occurrencesz{min,max}
min/max occurrences
hello world
exact match^hello
start of the stringsworld$
end of the string
If you were interested in practicing you can use this wonderful website:
https://regexr.com/