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

Last Reply 5 months ago By dharmendr

Posted 5 months ago

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

You are viewing reply posted by: dharmendr 5 months ago.
Posted 5 months 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