I need a regex which restricts an hour entry from 0-24 with the fraction in multiples of .25. Please keep in mind the following conditions must be met:
- When whole part is 0-23, the fractional part can be .0, .25, .5, or .75
- When whole part is 24, the fractional part can be .0
- When no whole part is present, the fractional part must be .0, .25, .5, or .75
- Empty string is not allowed
I am very confident that the following expression can be tightened up, but this is what is in place thus far:
(^(([0-9])|(1[0-9])|(2[0-3]))(\.((0*)|(250*)|(50*)|(750*)))?$)|(^24(\.0*)?$)|(^\.((0+)|(250*)|(50*)|(750*))$)
Update: The regex validation exists both on the client (javascript) and server (asp.net, c#).