MatchesXsDayTimeDuration🔗

Type: Pattern verification
Check that text conforms to the pattern of an xs:dayTimeDuration.
text🔗
Text to be checked
Return🔗
True if the text conforms to the pattern

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