Regex that allows only whole numbers and decimal upto 2 places:
Hi,
The following code is about a regular expression that allows only whole numbers and decimal numbers only upto two places.
string s = "1234.45";
Regex r = new Regex("^\\d+\\.*?\\d{0,2}$");
Match m = r.Match(s);
if (m.Success)
{
Response.Write("TRUE");
}
else
{
Response.Write("False");
}