Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2003, 10:06 PM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date regular Expression

Dear All,

I need a Regular Expression to validate a date
in dd-mmm-yyyy (12-Dec-2003).

Any help will be greatly appreciated.

Thanks in advance.

Regards,
pmotupal
 
Old November 10th, 2003, 01:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

how do u wanna to do it?! ServerSide or CilentSide?!
I've done it once by JavaScript & I guess that is the regular way!
so think about JavaScript & ...
Im here if u need any help.

Always:),
Hovik Melkomian.
 
Old November 10th, 2003, 03:43 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Hovik,

Thanks for the reply, I am doing this ASP.NET and I want to do this at the server side. I need a Reqular Expression to do this.

Thanks for your help



Praveen Motupally
 
Old November 11th, 2003, 01:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Ok dear, there is many ways to do it, I guess the simplest is using RegularExpressionValidator & for start up that's be nice for u too!
anyway its the sample for u, Here u should Enter the Date in dd-mm-yy format & if u wanna change that u should only change the expression & ...

Code:
<form id="Form1" method="post" runat="server">
    <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
    <asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ErrorMessage="Enter Valid Date!"
                ControlToValidate="TextBox1" ValidationExpression="\d{2}-\d{2}-\d{2}"></asp:RegularExpressionValidator>
    <asp:Button id="Button1" runat="server" Text="Button"></asp:Button>
</form>
or u may use CustomValidator, HTH.

Always:),
Hovik Melkomian.
 
Old November 11th, 2003, 04:00 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Hovik,

Thanks for all your help, the format I need is dd-mmm-yyyy.

Also please let me know any advanced way of validating this.

Your help is appreciated.



Praveen Motupally
 
Old November 12th, 2003, 04:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

well u can use CustomValidator to write ur Script.

HTH.

Always:),
Hovik Melkomian.
 
Old November 12th, 2003, 04:32 PM
Registered User
 
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I worked a bit hard,
and came up with this, expression, it validates dd-mmm-yyyy

^([012]?\d|3[01])-([Jj][Aa][Nn]|[Ff][Ee][bB]|[Mm][Aa][Rr]|[Aa][Pp][Rr]|[Mm][Aa][Yy]|[Jj][Uu][Nn]|[Jj][u]l|[aA][Uu][gG]|[Ss][eE][pP]|[oO][Cc]|[Nn][oO][Vv]|[Dd][Ee][Cc])-(19|20)\d\d$

Thanks for your help.

Praveen Motupally





Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular expression with date type ? nobitavn94 ASP.NET 1.0 and 1.1 Professional 2 December 21st, 2006 05:43 AM
REGULAR EXPRESSION pallone Javascript How-To 0 September 5th, 2006 06:52 AM
Regular Expression NewToXSL ASP.NET 1.0 and 1.1 Basics 1 June 13th, 2006 02:52 PM
regular expression vohra_vikas2004 ADO.NET 3 November 18th, 2004 09:59 PM
Regular Expression Help Greg Griffiths Javascript How-To 4 November 12th, 2004 05:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.