MatchesXsYearMonthDuration🔗
Check that
text
conforms to the pattern of an xs:yearMonthDuration
.
Code
yearMonthDurationRep = (
'-?P((([0-9]+Y)([0-9]+M)?)|([0-9]+M))'
)
pattern = (
f'^{yearMonthDurationRep}$'
)
return match(
pattern,
text
) is not None