MatchesXsDecimal🔗

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

Code

digit = '[0-9]'
unsignedNoDecimalPtNumeral = (
    f'{digit}+'
)
noDecimalPtNumeral = (
    f'(\\+|-)?{unsignedNoDecimalPtNumeral}'
)
fracFrag = (
    f'{digit}+'
)
unsignedDecimalPtNumeral = (
    f'({unsignedNoDecimalPtNumeral}\\.{fracFrag}|\\.{fracFrag})'
)
decimalPtNumeral = (
    f'(\\+|-)?{unsignedDecimalPtNumeral}'
)
decimalLexicalRep = (
    f'({decimalPtNumeral}|{noDecimalPtNumeral})'
)
pattern = (
    f'^{decimalLexicalRep}$'
)
return match(
    pattern,
    text
) is not None