* Matches the preceding character zero or more times ? Matches preceding character ZERO or ONE + Matches preceding character ONE or MORE times . Matches any ONE character except a newline | OR ^ Matches the beginning of lines [^] ^ When used inside square brackets will match any character not in class $ Matches the end of a line \A matches only at the start of a string \Z matches only at the end of the string \b word boundary () Used for grouping {m,n} at least m occurrences of the preceding character and at most n [0-9]{3,5} Will match at least 3 occurrences of 0-9 and at most 6 \d Matches any decimal digit == [0-9] \D Matches any non-digit character == [^0-9] \s Matches any whitespace character == [ \t\n\r\f\v] \S Matches an non-whitespace character == [^ \t\n\r\f\v] \w Matches any alphanumeric character == [-zA-Z0-9_] \W Matches any non-alphanumeric character == [^-zA-Z0-9_] re.DOTALL will match a newline using . [[https://docs.python.org/3.6/howto/regex.html | Python regex tutorial]] [[ https://docs.python.org/3/library/re.html | Python3 re module documentation]]