need ereg expression

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

need ereg expression

Post by bugthefixer »

my user enters time in the followin format

22:40

now i want to check whether user enters the same format i.e it should not be allowed to enter

22;40 or 22L40 or anything like tat

i need an ereg expression tat can check tat..
anybody can tell me how can i do tat
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

untested

Code: Select all

^(2ї0-4]|ї0-1]?ї0-9]):(ї0-5]?ї0-9])$
should allow 2:9 for 02:09 as well, unless you want it strict.. (just remove the ? marks then)
Post Reply