I have a validatio rule on contact which gives error when the name field contains non-alphabetic character.

Formual for the Vaildation rule is as follows :

   REGEX( FirstName , "[a-zA-Z]+"),
   REGEX( LastName , "[a-zA-Z]+"),
   REGEX( Subscriber_Middle_Name__c , "[a-zA-Z]*") 

Strange behaviour is that the above regex does not work. It works when I use NOT() with it as given below.

   NOT( REGEX( FirstName , "[a-zA-Z]+")),
   NOT( REGEX( LastName , "[a-zA-Z]+")),
   NOT( REGEX( Subscriber_Middle_Name__c , "[a-zA-Z]*")) 

Though it is exact opposite of what I want; it works. What is the possible reason behind this.


Regex Returns TRUE if Text matches the regular expression RegEx_Text. Therefore if you Field is right then it gets true as result.

For Validation rules - If this formula expression is true, display the text defined in the Error Message area.

It's fine behavior then (at least it works as described in docs)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.