struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Siddiq Syed <siddiq...@yahoo.com>
Subject RE: s:textfield and date format as dd/MM/yyyy
Date Wed, 04 Nov 2009 19:27:54 GMT

Does it checks for leap year ?

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

I guess this does not check for leap year, If the user enter the leap year
the framework passes the validation successfully. which it should not and
give you the error message.



Kawczynski, David wrote:
> 
> That is unreadable.  What about this, it's much easier on the eyes:
> (0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d
> 
> From 
> http://www.regular-expressions.info/regexbuddy/datemmddyyyy.html
> 
> 
>> 
>> Greg Lindholm-2 wrote:
>> > 
>> > <field-validator type="regex">
>> >>
>> >> 
>> (((((((0[13578])|(1[02]))[\/]((0[1-9])|([12]\d)|(3[01])))|(((0
>> [469])|(11))[\/]?((0[1-9])|([12]\d)|(30)))|((0?2)[\/]((0[1-9])
>> |(1\d)|(2[0-8]))))[\/](((19)|([1-9][0-9]))([\d][\d]))))|((0?2)
> [\/](29)[\/](((19)|([1-9][0-9]))(([02468][048])|([13579][26]))))> )$
>> >> </field-validator>
>> >>
>> >>
>> >>
>> > IMHO this is unreadable and unmaintainable and should never 
>> be used (even
>> > if
>> > it does work).
>> > 
>> > You would be better off changing your 'date' property to be 
>> a String and
>> > handle validation in a validate() method using a DateFormat object.
>> > 
>> > 
>> 
>> -- 
>> View this message in context: 
>> http://old.nabble.com/s%3Atextfield-and-date-format-as-dd-MM-y
> yyy-tp26197512p26202747.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>> 
>> 
> Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
> Jersey, USA 08889), and/or its affiliates Direct contact information for
> affiliates is available at http://www.merck.com/contact/contacts.html)
> that may be confidential, proprietary copyrighted and/or legally
> privileged. It is intended solely for the use of the individual or entity
> named on this message. If you are not the intended recipient, and have
> received this message in error, please notify us immediately by reply
> e-mail and then delete it from your system.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/s%3Atextfield-and-date-format-as-dd-MM-yyyy-tp26197512p26203058.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message