MatchesXsGYearMonth🔗
Check that
text conforms to the pattern of an xs:gYearMonth.
Code
g_year_month_rep = (
r"-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])"
r"(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
)
pattern = f"^{g_year_month_rep}$"
return match(pattern, text) is not None