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

line1 = 'There is a phone number 12345 in this row and another 42 number'

numbers1 = re.findall(r'\d+', line1)
print(numbers1) # ['12345', '42']

line2 = 'There are no numbersin this row. Not even one.'
numbers2 = re.findall(r'\d+', line2)
print(numbers2) # []

re.findall returns the matched substrings.