# Validation Expression

I need to build a validation expression for .NET that will accept whole numbers up to max of 24 or quarters. examples:

1 < Should Work
24.50 < Should NOT work because its over the whole 24
1.25 < Should work
.35 < Should NOT work because its decimal is not within a quarter
.50 < Should work
23.50 < Should Work
23.87 < Should NOT work because its decimal is not within a quarter
17.75 < Should Work

I currently have the current expression:
^([0-9]|1[0-9]|2[0-4])((\.0+)*|(\.250*)|(\.50*)|(\.750*))\$

But... this expression is falling short of what i need.
###### Who is Participating?

Commented:
This should work:

^((([0-9]|1[0-9]|2[0-3])((\.0+)*|(\.250*)|(\.50*)|(\.750*)))|((\.250*)|(\.50*)|(\.750*))|(24)|(24.0))\$
0

Commented:
Try this:

``````^(?:[0-1]\d|2[0-3](?\.(?:25|50|75))?)|24\$
``````
0

Author Commented:
ASP.NET did not like the syntax of that Expression. I get the following error message:

Microsoft JScript runtime error: Unexpected quantifier
0

Commented:
Try this:
``````^(?:[0-1]\d|2[0-3](?:\.(?:25|50|75))?)|24\$
``````

OR
``````^([0-1]\d|2[0-3](\.(?:25|50|75))?)|24\$
``````
0

Author Commented:
PERFECT!
0

Commented:
Did you try my one again??
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.