[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rt-users
Subject:    Re: [rt-users] Custom field format validation without being
From:       Kevin Falcone <falcone () bestpractical ! com>
Date:       2011-07-27 21:50:12
Message-ID: 20110727215012.GM807 () jibsheet ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Wed, Jul 27, 2011 at 11:59:44AM -0700, Edward Frye wrote:
>      How can I setup a custom field validation and have if so that it can be blank, OR match my
>      regular expression
>      Currently I have: (?#YYYY-MM-DD HH:mm:ss)^[12]\d{3}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$
>      Really what I guess what I think I'm looking for is /(^[12]\d{3}-\d{2}-\d{2}
>      \d{2}:\d{2}:\d{2}$|^$)/

perldoc perlre will tell you more than you ever wanted to know, but
something like:
/^(?:foo|)$/ or /^foo$|^$/
is what you want to emulate.

Remember that the (?#YYYY-MM...) part needs to be self contained since
it isn't an active part of the regex.

-kevin

[Attachment #5 (application/pgp-signature)]

--------
2011 Training: http://bestpractical.com/services/training.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic