Generate a program in Python to extract all numbers from a given string
string = "The 3 monkeys had 2 apples"
import re

def extract_numbers(string): 
    numbers = re.findall('\d+', string)
    return numbers

string = "The 3 monkeys had 2 apples"
print(extract_numbers(string))