Friday, 8 August 2014

Indian Currency Checking by regular Expression

Indian Currency Checking by regular Expression

This regular expression looks for any number of digits. And if dot character is added it will look for decimal places upto 2 decimals.
HTML Page:

<asp:TextBox ID="TextBox1" runat="server" />
<br />
<asp:RegularExpressionValidator ID="Regex1" runat="server" ValidationExpression="((\d+)((\.\d{1,2})?))$"
ErrorMessage="Please enter valid integer or decimal number with 2 decimal places."
ControlToValidate="TextBox1" />