**UPDATE 22 June 2022

For simplicity sake, I will edit my question to have emails separated with just semicolon e.g. 213@aaa.com;424@www.com

So I have this Long Text Area field to capture multiple email addresses inside like :

abc@xyz.com; ac_cs@asd.com

And I want to create a Salesforce Validation rule to ensure email list are well formed separated by ; or ,.

I tried using the Regex I found on this exchange and other sites to come up with :

NOT(REGEX(CS_Email_List__c  ,"(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*|"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"))

But I can never get it correct. Help pls?

2 Answers 2


Try with below validation rule separated by comma(,) or semi colon(;).

REGEX( CS_Email_List__c , "([a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z,]{2,4})*")
REGEX( CS_Email_List__c , "([a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z;]{2,4})*")
AND(RIGHT( CS_Email_List__c  , 1 ) = ",",

RIGHT( CS_Email_List__c , 1 ) = ";")

  • Your code is too convoluted. I finally made a regex to work. props on you for trying
    – compski
    Jun 16, 2022 at 7:59
  • My code will allow, comma or semi colon between the email addresses and end it will not allow comma or semi colon. ex abc@gmail.com,bcd@gmail.com or abc@gmail.com;bcd@gmail.com will allow in the text area field. It should not allow emails like abc@gmail.com,bcd@gmail.com, or abc@gmail.com;bcd@gmail.com; or abc@gmail.com;bcd@gmail.com,bbr@gmail.com Jun 16, 2022 at 8:31

After building my regex on https://regex101.com/.. I managed to come up with a single line regex that helped me.

This might not cover all email cases but it does for all my tests.

     CS_Email_List__c , 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .