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: pgp7tsZ5fRQlJ.pgp
Description: PGP signature

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

Reply via email to