Validated Custom Field that is also Optional?

When I create a custom field with a regex for validation, the fact that the regex exists seems to force the Custom Field to be a Required field. Is there a way for the Custom Field to be Optional but still have a validation pattern?

You just have to use a regex that allows empty string. If you give us your regexp, I can help you :slight_smile:

Yeah, I suspected something like that, but I’m not sure I know the best way.

Our pattern looks like 20987-333 so the regex I was using is ^\d{5}\-{1}-\d{3}$

Thanks for your reply!

Your current regex won’t match that, it seems it will match 20987--333 though? You can add an optional empty value:

^\d{5}-{1}-\d{3}$|$^

This interface was munging my regex. I’ll try to do a code block.
I think this is what I was using.

^\d{5}\-{1}\d{3}$
^\d{5}\-{1}\d{3}$|^$

This seems to work great for me. thanks for your help!