regular expression for date

Posted by Kavi.Sirius under C# on 5/25/2012 | Points: 10 | Views : 2974 | Status : [Member] | Replies : 4
regular expresssion for mm-dd-yyyy format in c#

Regards
Kavi.n



Responses

Posted by: Sekar.C on: 5/25/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
ValidationExpression="^([012]\d|30|31)/(0\d|10|11|12)/\d{4}$"

Regards
Sekar.c

Kavi.Sirius, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ravianand on: 5/25/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

ValidationExpression="^[0-9m]{1,2}/[0-9d]{1,2}/[0-9y]{4}$"

Regards,
Ravi

Kavi.Sirius, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 6/15/2012 [Member] Bronze | Points: 25

Up
0
Down

Posted by: Muralidosscm on: 6/25/2012 [Member] Starter | Points: 25

Up
0
Down
Date Format (dd/mm/yyyy) Regular Expression Pattern

(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d)
Description

( #start of group #1
0?[1-9] # 01-09 or 1-9
| # ..or
[12][0-9] # 10-19 or 20-29
| # ..or
3[01] # 30, 31
) #end of group #1
/ # follow by a "/"
( # start of group #2
0?[1-9] # 01-09 or 1-9
| # ..or
1[012] # 10,11,12
) # end of group #2
/ # follow by a "/"
( # start of group #3
(19|20)\\d\\d # 19[0-9][0-9] or 20[0-9][0-9]
) # end of group #3

Regards
Muralidoss M

Kavi.Sirius, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response