I want the regular expression to validate multiple email address for a long text field separated by comma but validation should be put so that field should accept the data in the email ID format (ex: xyz@aig.com,@xyz@abc.in,xyz@abc.uk)only.
I have tried the regular expression:-
^([A-Za-z]+[A-Za-z0-9.-]+@(([aig.com])|([abc.in])|([abc.uk]))+\.[A-Za-z]{2,4}(\s*(;|,)\s*|\s*$))+$)
This expression is also accepting the email id if user enters (ex: abc@aig.uk,abc@aig.in)
>Solution :
You can use this to validate specified list:
^(?:(?:[A-Za-z][A-Za-z0-9.-]*@(?:aig\.com|abc\.in|abc\.uk))(?:,|$))*$
Worth noting: (?:aig\.com|abc\.in|abc\.uk) matches any of aig.com, abc.in, abc.uk.
In your attempt [] where not needed as [aig.com] matches a, acc.cc.s or any permutation of symbols inside square brackets.
Also (?:,|$) matches either , or end of the string.