MatchesXsDecimal🔗
Check that
text
conforms to the pattern of an xs:decimal
.
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