[rt-users] Help with validate code

Shawn M Moore sartak at bestpractical.com
Tue May 10 16:02:37 EDT 2011


(平成23/05/10 16:00), Kenneth Crocker wrote:
> To list,
>
> I'm trying to ensure that a date & time entry for a custom field is
> correct. I am using the following code in the validation box:
>
> (?#Date mm/dd/yyyy
> hh:mm-military)^((0[1-9]|1[0-2])\/(0[1-9]|[1-2][0-9]|3[0-1])\/([1-2][0-9][0-9][0-9])
> (0[0-9]|1[0-4]):(0[0-9]|1[0-9]))?$
>
> I also tried:
>
> (?#Date mm/dd/yyyy
> hh:mm-military)^((0[1-9]|1[0-2])\/(0[1-9]|[1-2][0-9]|3[0-1])\/([1-2][0-9][0-9][0-9])
> (0[1-9]|1[0-2]):(0[0-9]|1[0-9]))?$
>
> and that didn't work either. I get this error message:
>
> "Could not add new custom field value: Input must match [Date mm/dd/yyyy
> hh:mm-military]".
>
>   I figured the problem was with my "time" code, but what do I know? ;-).
>
> Any help would be greatly appreciated.
>
> Kenn
> LBNL

Yeah, this looks like your regex is failing to match against whatever 
you're putting into the field.

What values are you trying to put into this custom field that you expect 
to work?



More information about the rt-users mailing list