I need some help with the correct syntax of a regular expression for my spam filter. I have two domains let's call them domainA and domainB. The spam filter in question is part of domainB and is used to restrict inbound/ outbound email to only be allowed to DomainA. Since the spam filter support regular expression, it would be ideal to have a regular expression that says if not domainA or domainB then make as spam.
I have tried ^(domainA|domainB) and ^((?!domainA$)|(?!domainB$)).*$ without success.
Can somebody please help me with the correct syntax.