0
Q:

re module documentation

import re
#	Compile a regular expression pattern into a regular expression object, which can be used for matching using its match(), search() and other methods, described below.

prog = re.compile(pattern)
result = prog.match(string)

#	is equivalent to

result = re.match(pattern, string)
4
import re

result = re.sub(pattern, repl, string, count=0, flags=0);
2
>>> m = re.search(r'(?<=-)\w+', 'spam-egg')
>>> m.group(0)
'egg'
0

New to Communities?

Join the community