python regex group code example
Example 1: python regex search group
>>> m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
>>> m[0]
'Isaac Newton'
>>> m[1]
'Isaac'
>>> m[2]
'Newton'
Example 2: re python3
import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def'
Example 3: python re.search()
match = re.search(r'bb', 'aabbcc')
match = re.search(r'cd', 'aabbcc')
match = re.search(r'...c', 'aabbcc')
match = re.search(r'\d\d\d', 'p123g')
match = re.search(r'\w\w\w', '@@abcd!!')
Example 4: python re
parse("Today is Dec 1 16", fuzzy_with_tokens=True)
parse("Today is Dec 1 14", fuzzy_with_tokens=True)
parse("Today is Nov 30 12", fuzzy_with_tokens=True)