I've tried to validate a own format (day,day,number,number) in my Ruby-Controller. The day has always two numbers (4-> 04). What i tried is the following:
... format: { with: /\A(0[1-9]|[12]\d|3[01]){2}\p{L}{2}\z/, message: "wrong format" }
(0[1-9]|[12]\d|3[01])
comes from https://stackoverflow.com/a/6077026. This should validate the day. Then i add {2}
because i want exactly two of these day-inputs. Finally \p{L}
with {2}
for two letters.
Does anyone know what i do wrong?
3131zz
should be accepted. 3231zz
not.
Thanks