import re

text = 'This is some text -- with punctuation.'

print(text)
print()

patterns = [
    r'^(?P<first_word>\w+)',
    r'(?P<last_word>\w+)\S*$',
    r'(?P<t_word>\bt\w+)\W+(?P<other_word>\w+)',
    r'(?P<ends_with_t>\w+t)\b',
]

for pattern in patterns:
    regex = re.compile(pattern)
    match = regex.search(text)
    print("'{}'".format(pattern))
    print('  ', match.groups())
    print('  ', match.groupdict())
    print()


05420354d1b028993425c79b9e72f6954a13b0d0
<mask token>

<mask token>
print(text)
print()
<mask token>
for pattern in patterns:
    regex = re.compile(pattern)
    match = regex.search(text)
    print("'{}'".format(pattern))
    print('  ', match.groups())
    print('  ', match.groupdict())
    print()

<mask token>
text = 'This is some text -- with punctuation.'
print(text)
print()
patterns = ['^(?P<first_word>\\w+)', '(?P<last_word>\\w+)\\S*$',
    '(?P<t_word>\\bt\\w+)\\W+(?P<other_word>\\w+)', '(?P<ends_with_t>\\w+t)\\b'
    ]
for pattern in patterns:
    regex = re.compile(pattern)
    match = regex.search(text)
    print("'{}'".format(pattern))
    print('  ', match.groups())
    print('  ', match.groupdict())
    print()

import re
text = 'This is some text -- with punctuation.'
print(text)
print()
patterns = ['^(?P<first_word>\\w+)', '(?P<last_word>\\w+)\\S*$',
    '(?P<t_word>\\bt\\w+)\\W+(?P<other_word>\\w+)', '(?P<ends_with_t>\\w+t)\\b'
    ]
for pattern in patterns:
    regex = re.compile(pattern)
    match = regex.search(text)
    print("'{}'".format(pattern))
    print('  ', match.groups())
    print('  ', match.groupdict())
    print()

import re

text = 'This is some text -- with punctuation.'

print(text)
print()

patterns = [
    r'^(?P<first_word>\w+)',
    r'(?P<last_word>\w+)\S*$',
    r'(?P<t_word>\bt\w+)\W+(?P<other_word>\w+)',
    r'(?P<ends_with_t>\w+t)\b',
]

for pattern in patterns:
    regex = re.compile(pattern)
    match = regex.search(text)
    print("'{}'".format(pattern))
    print('  ', match.groups())
    print('  ', match.groupdict())
    print()

