MatchesXsTime🔗

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

Code

time_rep = (
    r"(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))"
    r"(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?"
)

pattern = f"^{time_rep}$"
return match(pattern, text) is not None