Using Regular Expressions with Mailing Lists

What is this article about?

Regular expressions are used within many programming languages to specify rules for matching strings of text. In other words, you can use regular expressions to match text in incoming email messages. The settings in which you use the regular expressions will tell the Mailing list software what to do with the messages that have matching text.

The settings in the Mailing list software will also accept non-regular expression text, so the software needs to be able to determine whether the text that is entered is a regular expression or not. To specify that a text is a regular expression, begin the line with a caret ( ^ ) character, also known as the circumflex accent when modifying another character. 

Common use of regular expressions in Mailing Lists

Specify domains that are allowed to post

The most common use of regular expressions in a Mailing list is to specify entire domains that can, or cannot, post messages to the list. For example, to allow all address in the domain, even those address that are not subscribed, to post messages without moderation to your list, go to Privacy Options, and then the Send filters subsection and enter the following regular expression in the accept_these_nonmembers setting:


The ^ specifies that the string is a regular expression. The .* specifies that any text that comes before the "" part of the email address of the sender is acceptable. For example,,, and will all match the regular expression. The \ specifies that the subsequent period is part of the text of the string you want to match and not a special character that can be used in regular expressions. The $ specifies that it is the end of the string.

Please be aware that spammers often forge the headers of spam email. If the forged From header is set to an email address ending in, that message will be able to get through to your list. If you are concerned about spam on your list, review the following KB articles for some options on securing your mailing list.


Specify domains that are not allowed to post

To ban an entire domain from being able to post to your list and have the mailing list software automatically discard all messages from that domain, go to Privacy Options, then the Send filters subsection, and enter the following regular expression in the discard_these_nonmembers setting:


Where domain is the domain you want to block. For example: ^.*somespammer\.com$


Ban domains from subscribing

If you want to ban all non-UA email address from subscribing to your list, go to Privacy Options, then the Subscription rules subsection, and enter the following regular expression in the ban_list setting:


As you can see, this regular expression is a little more complex than the proceeding ones. This regular expression is known as a negative lookahead and is telling the mailing list software to match subscribing email addresses that don't end in "" and to ban those matching email addresses.


Other Uses

There are many more uses of regular expressions. This page was not designed to go into all the uses; it is only meant to give you a simple overview of how regular expressions are used to manage mailing lists. For more information on specific settings that may use regular expressions, look through the other mailing list help pages on this site. While not necessarily mentioning the term "regular expression," other pages may contain information on how to accomplish specific tasks by using regular expressions.


Settings that use regular expressions

The following settings in the mailing list software will accept regular expressions:

  • accept_these_nonmembers (Privacy Options category → Sender Filters subsection)
  • acceptable_aliases (Privacy Options category → Recipient Filters subsection)
  • ban_list (Privacy Options category → Subscription Rules subsection)
  • bounce_matching_headers (Privacy Options category → Spam Filters subsection)
  • discard_these_nonmembers (Privacy Options category → Sender Filters subsection)
  • header_filter_rules (Privacy Options category → Spam Filters subsection)
  • hold_these_nonmembers (Privacy Options category → Sender Filters subsection)
  • reject_these_nonmembers (Privacy Options category → Sender Filters subsection)


Need additional help or have issues

For additional assistance contact the IT Services Technical Support Center via phone at (907) 786-4646, toll-free at (877) 633-3888, or email at


Article ID: 70
Wed 4/1/20 12:40 PM
Fri 4/17/20 8:54 AM

Related Articles (1)