test regex python in string flags code example
Example 1: python named group regex example
>>> re.search(r'(?P<name>[^-]+)-(?P<ver>\d.\d.\d-\d+).tar.gz', 'package_name-1.2.3-2004.tar.gz').groupdict()
{'name': 'package_name', 'ver': '1.2.3-2004'}
Example 2: Python Regex documentation\
>>> import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def'
Example 3: re python3
import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def'