📅  最后修改于: 2022-03-11 14:47:10.476000             🧑  作者: Mango
# re date validate/extract particular dd/mm/yyyy
s= 24-12-2021
l = re.compile("^(?P[0-9]{2})-(?P[0-9]{2})-(?P[0-9]{4})$")
m = re.search(r,s)
if m:
print(m.group("year"))
else:
print("pattern not found")