struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Lindholm <greg.lindh...@gmail.com>
Subject Re: s:textfield and date format as dd/MM/yyyy
Date Wed, 04 Nov 2009 19:33:43 GMT
Still a bad idea as it allows invalid dates (e.g. Nov. 31) and does nothing
for leap years.

If you want to know if a date is valid use DateFormat.parse().


On Wed, Nov 4, 2009 at 2:16 PM, Kawczynski, David <
david_kawczynski@merck.com> 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<http://old.nabble.com/s%3Atextfield-and-date-format-as-dd-MM-y%0Ayyy-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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message