MatchesXsFloat🔗

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

Code

float_rep = (
    r"((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?" r"|-?INF|NaN)"
)

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