Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
need Regular Expression
i want enter the Hours in text box in following format but not more then 24 from

&
00,01,02,03----24
0,1,2,3----24

no negative number or albhabet
Posted
Comments
Sergey Alexandrovich Kryukov 21-Mar-12 19:42pm    
Why, exactly? In many cases, you need to try to convert a string to some date/time type and see if it works.
--SA

1 solution

Try:
\d{1,2}
Digit, one or two only.
If you want only 0-24, then you would have to list them individually:
00|01|02|0|1|2
(only all the way to 24)

To be honest, I wouldn't use a regex alone: I would convert the text box content to a number, and check that.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900