regex - Validated a number with 2 decimal place and less than 1000 -
i know there many similar question being asked, need on , if possible please provide me easy follow , easy understand tutorial regex.
here valid scenario 999.99 valid 100.00 valid 1111.00 invalid 111.002 invalid
the code should written in pattern dont know how code output want
thank in advance!
you can set restriction in xsd document:
<xsd:simpletype name="2dnumber"> <xsd:restriction base="xsd:token"> <xsd:pattern value="[0-9]{1,3}\.[0-9]{2}|1000.00"/> </xsd:restriction> </xsd:simpletype>
or if want use xs:decimal
directly:
<xsd:simpletype name="2dnumber"> <xsd:restriction base="xsd:decimal"> <xsd:minexclusive value="0"/> <xsd:maxexclusive value="1000"/> <xsd:fractiondigits value="2"/> </xsd:restriction> </xsd:simpletype>
Comments
Post a Comment