Capture more

import re

line = 'There is a phone number 12345 in this row and an age: 23'

match ='(\w+): (\d+)', line)
if match:
    print(  # age: 23
    print(  # age     the first group of parentheses
    print(  # 23      the second group of parentheses

    # print(  # IndexError: no such group
    print(match.groups())  # ('age', '23')
    print(len(match.groups()))  # 2
Some groups might match '' or even not match at all, in which case we get None in the appropriate call and in the match.groups() call