How can add a condition in this code that it detect only date in between 1-31 and moth in between 1-12
import re
string = input("Enter a string: ")
pattern = re.compile(r'\d\d.\d\d.\d\d\d\d')
matches = pattern.findall(string)
for match in matches:
print(match)