Logic problem with custom field validation in 3.5.6?

First, let me say that this is a feature that I was glad to see come out
:slight_smile: I was playing around with it, and noticed one problem: if you
specify a pattern, that automatically implies that the field is
mandatory. What seems more desirable is something to distinguish
mandatory from not. That is, you can put in a year value here if you
want to, but if you do, it better match ^[12]\d{3}$ . Iā€™m working on
this now, and thinking my solution would be to provide another "field"
to the pattern that can be parsed out. For instance:

(?#Year){?#0)^[12]\d{3}$

The second parenthesized group would be 1 for mandatory, 0 for not.

Eric Schultz