Regular Expression for decimal number between 0.0 to 999.9 in ASP.Net

Last Reply one month ago By dharmendr

Posted one month ago

Can anyone please provide regular expression for decimal num 0.0 to 999.9

You are viewing reply posted by: dharmendr one month ago.
Posted one month ago

HI amar,

Use below Regular Expression.

(?=.*[0-9])\d{0,3}(?:\.\d{0,1})?$

HTML

<asp:TextBox ID="TextBox1" runat="server" />
<br />
<asp:RegularExpressionValidator ID="Regex1" runat="server" ValidationExpression="(?=.*[0-9])\d{0,3}(?:\.\d{0,1})?$"
    ErrorMessage="Please enter valid integer or decimal number." ControlToValidate="TextBox1" />

Output

Valid

0.0

999.0

Invalid

999.00

9990.0