Regex with re.search
Use named groups with the re stdlib and access them via groupdict().
Author:
chris
// Language: Python
import re
text = "Date: 2026-05-12"
m = re.search(r"(?P<y>\d{4})-(?P<m>\d{2})-(?P<d>\d{2})", text)
if m:
print(m.groupdict())