[rt-users] Help with validate code

Shawn M Moore sartak at bestpractical.com
Tue May 10 16:25:23 EDT 2011


(平成23/05/10 16:19), Kenneth Crocker wrote:
> Shawn,
>
> I enter (without the quotes) "05/02/2011 03:29". There is a blank
> between "2011" and "03:29".
>
> I don't see why it doesn't like it?

Your regex is buggy.

perl -le '"05/02/2011 03:29" =~ qr{(?#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]))?$}; print $&'

prints nothing, which means it didn't match. Your minute part will only 
match 00-19. 1[0-9] should probably be [1-5][0-9]



More information about the rt-users mailing list