import re

# m = re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")
# print(m.group(0))      # Isaac Newton
# print(m.group(1))      # Isaac
# print(m.group(2))      # Newton
# print(m.group(1, 2))      # ('Isaac', 'Newton')


m2 = re.match(r"(?P<first_name>\w+) (?P<last_name>\w+)", "Malcolm Reynolds")
print(m2.group('first_name'))       # Malcolm
print(m2.group('last_name'))        # Reynolds
