re.compile
Compile a regular expression pattern into a regular expression object, which can be used for matching using its match(), search() and other methods.
re.compile(pattern, flags=0)
pattern
The regular expression to compile.
flags
Flags that modify the expression`s behavior.
Examples
>>> import re
>>> prog = re.compile(r'\d+')
>>> prog.findall('12 drummers')
['12', '11']