Did you got the chance to look into the python documentation?
Regex: you'll need to know:
'*' Causes the resulting RE to match 0 or more repetitions of the
preceding RE, as many repetitions as are possible. ab* will match ‘a’,
‘ab’, or ‘a’ followed by any number of ‘b’s.
'?' Causes the resulting RE to match 0 or 1 repetitions of the
preceding RE. ab? will match either ‘a’ or ‘ab’.
'\' Either escapes special characters (permitting you to match
characters like '*', '?', and so forth), or signals a special
sequence. so to check '\' you need to put it as '\'. For example, to
match a literal backslash, one might have to write '\\' as the
pattern string, because the regular expression must be \, and each
backslash must be expressed as \ inside a regular Python string
literal.
If you need to know how to use regex in python:
Python string.replace regular expression