regular expression character classes and atoms

Character Classes

Character classes Python Rg Vim
Word char \w same \w
Space \s same \s
Multiline re.DOTALL / (?s) --multiline or (?s) \_.

Atoms / Special Characters

Atoms Python Rg Vim
zero or more ? same ?
1 or more + same +
precise number of matches {n,m} same {n,m}
word boundary \b same < >
multiple patterns or | same |
non greedy .*? same .{-}
line starts with ^ same ^
line ends with $ same $
group ( ) same ( )
back reference \1 \2 \3 \1 \2 \3
set start of match \zs
set end of match \ze

Example: to match company and companies