MatchesXsDayTimeDuration🔗
Check that
text
conforms to the pattern of an xs:dayTimeDuration
.
Code
dayTimeDurationRep = (
'-?P((([0-9]+D)(T(([0-9]+H)([0-9]+M)?([0-9]+(\\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\\.[0-9]+)?S)?|([0-9]+(\\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\\.[0-9]+)?S)?|([0-9]+(\\.[0-9]+)?S))))'
)
pattern = (
f'^{dayTimeDurationRep}$'
)
return match(
pattern,
text
) is not None