in reply to Regex Expression to filter email for Barracuda Email Appliance

G'day higginss20,

Welcome to the Monastery.

I think, in the first instance, you should follow ++roboticus' advice and contact Barracuda with a different question.

As a general rule, using a regular expression to match an exact string is a poor and inefficient choice. It would be much better to just use 'eq', or 'ne' to check for a non-match (see "perlop: Equality Operators"):

if ($email_address eq 'first.last@example.com') { # OK - process normally } else { # Possibly not OK - phishing check }

If $displayname has more than one email address, use a hash and check with exists:

my %valid_email_for = ( 'Display Name' => { 'first.last@example.com' => 1, 'first.last@example.net' => 1, 'first.last@example.org' => 1, }, ); ... if (exists $valid_email_for{$displayname}{$email_address}) { # OK - process normally } else { # Possibly not OK - phishing check }

— Ken