Q:

asp.net regular expression validator for decimal

Am using the below expression to validate a textbox with decimal number. But it accept 12, -1.0,12.0,12.5,1.0 etc. But i want a regular expression like this "12.4". First two digit and decimal point and followed by a single digit. 
ValidationExpression="^-?[0-9]{0,2}(\.[0-5]{1,1})?$|^-?(100)(\.[0]{1,2})?$" 

A:

First of all, that regex is severely overcomplicated. The whole thing could be rewritten as 
^-?([0-9]{0,2}(\.[0-5])?|100(\.00?)?)$

...and have the exact same effect. But based on your comment, you're looking for something much more strict:
^[0-9]{2}\.5$

I'm not clear on why you want to do that, but this does exactly what you've described. If you don't want to force the last digit to be 5 (your comment was unclear), use ^[0-9]{2}\.[0-9]$.

