examples/regex/match_numbers.py
from __future__ import print_function
import re

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

match = re.search(r'\d+', line)
if match:
  print(match.group(0))  # 12345

Use raw strings for regular expression: r'a\d'. Especially because \ needs it.

It matches the first occurrence. Here we can see that the group(0) call is much more interesting than earlier.