I have a zipcode input field on a visualforce page. This field could be hidden (rendered = false) based on certain needs. I have the following field validation to ensure a proper zipcode format is entered. If the zip code field is hidden the validation runs when trying to save the record. I need it to not run in this case.
NOT(REGEX( Insured_ZipCode__c , "\\d{5}(-\\d{4})?"))