寻找包含一组单词的正则表达式

Looking for a regular expression which does contain a set of words

我正在尝试为我的 Postfix header_checks 文件创建一个正则表达式,以便它匹配 包含 .com、.net 或 .org 的字符串域扩展。

以下正则表达式似乎在 regex101 中有效,但在 Postfix 中失败。

/^From: .*\.(?!(com|net|org)>)/ HOLD

所有邮件(包括 .com、.net 等)都排在队列中,这显然不是我想要的。

我希望正则表达式匹配如下字符串:

From: Example Mail <example@domain.bid>
From: Example Mail <example@domain.bid.co>

知道我的正则表达式哪里出了问题吗?

根据regexp_table正则表达式匹配多行 模式关闭,这意味着 ^ 只匹配字符串的开头而不是 行首。

By default, matching is case-insensitive, and newlines are not  treated
as  special  characters. The behavior is controlled by flags, which are
toggled by appending one or more of the following characters after  the
pattern:

i (default: on)
       Toggles  the case sensitivity flag. By default, matching is case
       insensitive.

m (default: off)
       Toggle the multi-line mode flag. When this flag is on, the ^ and
       $  metacharacters match immediately after and immediately before
       a newline character, respectively, in addition  to  matching  at
       the start and end of the input string.

(顺便说一句,我更喜欢 "[.]" 而不是 "\." 并且会使用非捕获组来替代:"(?:com|net|org)")。