I need regular expression format "mm/dd/yyyy" || "mm/dd/yyyy hh:mm:ss am/pm" for both the conditions

Posted by Gaddad under ASP.NET on 12/8/2009 | Views : 2601 | Status : [Member] | Replies : 2
I need regular expression format "mm/dd/yyyy" || "mm/dd/yyyy hh:mm:ss am/pm" for both the conditions

Please help me.

Thanks in Advance..




Responses

Posted by: Abhi2434 on: 12/8/2009 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
You might try this :

(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])(19|20)\d\d[- /.](0[1-9]|1[0-2]):[0-5][0-9]\s+([ap]m|[AP]M)|)


I wrote this directly here. Let me know if it gives any problem.

Also, It can also be shortened by spending more time on it.

Cheers.

www.abhisheksur.com

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

Posted by: Gaddad on: 12/9/2009 [Member] Starter

Up
0
Down
Hi,

Thanks for your early response, but it is getting error
"(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])(19|20)\d\d[- /.](0[1-9]|1[0-2]):[0-5][0-9]\s+([ap]m|[AP]M)|) is not a valid regular expression."



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

Login to post response