Generate a python program that matches regular expression pattern.
pattern = "\d+"
text = "I have 3 cats and 5 dogs"
import re

def regex_match(pattern, text):
    regex = re.compile(pattern)
    matches = regex.findall(text)
    return matches