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

amar
 
on Apr 23, 2020 08:15 AM
1772 Views

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

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Apr 23, 2020 08:16 AM

I will get back to you soon.

dharmendr
 
on Apr 23, 2020 10:23 AM

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