Geeks With Blogs
Gaurav Taneja Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

case "time":

 {

                            //Regex regExpression = new Regex(@"^(\d{2}):(\d{2})\s{1}(([aA])|([pP]))[mM]$");

                            //new Regex(@"^(\d{2}):(\d{2})\s{1}([AP]M)$");

                            // ^(([1-9]{1})|([0-1][1-2])|(0[1-9])|([1][0-2])):([0-5][0-9])(([aA])|([pP]))[mM]$

                            Regex regExpression = new Regex(@"^(([1-9]{1})|([0-1][1-2])|(0[1-9])|([1][0-2])):([0-5][0-9])\s{1}(([aA])|([pP]))[mM]$");

                            if (drValidation["value"].ToString().Trim().Length > 0)

                                if (!regExpression.IsMatch(drValidation["value"].ToString().Trim()))

                                {

                                    strError.Append("<Error code='" + drValidation["errCode"].ToString() + "' description='" + drValidation["errMessage"].ToString().Replace("~~", drValidation["fieldName"].ToString()) + "'/>");

                                    blnReturnVal = false;

                                }

                            break;

                        }

Posted on Thursday, March 13, 2008 11:52 PM Validation | Back to top


Comments on this post: Server Validation for Time HH:MM M/PM format

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Gaurav Taneja | Powered by: GeeksWithBlogs.net