[SalesForce] Validation Rule Only Fires If Field NOT Blank

I am attempting to create a validation rule on a field that ensures a time is formatted correctly. This is only if the user enters a time, whereas if left blank, one is automatically generated and that is fine, thus the validation rule should not fire.

Currently I have this, which isn't working (Rule fires no matter what):

( NOT(REGEX(  Presentation_Start_Time__c  , "[0-1]?[0-9]:[0-5][0-9] [A|P]M")) || NOT(ISBLANK(Presentation_End_Time__c)) ) 
&& 
( NOT(REGEX(  Presentation_End_Time__c  , "[0-1]?[0-9]:[0-5][0-9] [A|P]M")) ||  NOT(ISBLANK(Presentation_End_Time__c)) )

Best Answer

You seem to have misunderstood validation rules. If they evaluate to true then they fire and block saving the record.

So try this:

AND(NOT(ISBLANK(Presentation_End_Time__c)),NOT(REGEX(  Presentation_Start_Time__c  , "[0-1]?[0-9]:[0-5][0-9] [A|P]M")))
Related Topic