[Users] Filter is not working as expected

Marcio Andrey Oliveira plicatibu at gmail.com
Mon Oct 9 20:04:43 UTC 2023


Hi.

I'm trying to create a filter that will set the color label to red if it
contains someone whose domain does not pertain to our enterprise in the
fields From, To or Cc.

So, suppose that my domain is example.com.

I created the following regex:

\b[A-Za-z0-9._%+-]+@(?!example\.com)[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b

That is working fine, as one can see here:

https://regex101.com/r/JGowF8/1

Also, this same regex works perfectly in a filter created in Thunderbird.

The filter created in Claws is as follow:

Name: highlight non-coworker users
Condition: from regexpcase
"\\b[A-Za-z0-9._%+-]+@(?!axiros\\.com)[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b" |
~to_or_cc regexpcase
"\\b[A-Za-z0-9._%+-]+@(?!axiros\\.com)[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b"
Action: color 2

My problem is that it's matching nothing when the filter runs. I believe
the problem has to do with the escaping of "*\*" that Claw is doing, but
I'm not sure.

The problem happens on both Windows 11 and on Debian 12.
I'm using the version (4.1.1-1-64bit in Windows and 4.1.1 in Debian.).

Below is a snippet from the filtering.log

2023-10-09 16:37:55] filtering message (manually)
                       message file:
C:\Users\plicatibu\AppData\Roaming\Claws-mail\imapcache\mail.example.com\
plicatibu at example.com\INBOX\28927
                       Date: Mon, 9 Oct 2023 14:10:47 +0000
                       From: Regular Joe <rjoe at duck.com>
                       To: Plicatibu <plicatibu at example.com>, Tester <
tester at example.com>
                       Subject: Check the bugs
[2023-10-09 16:37:55] processing rule 'highlight non-example users' [ from
regexpcase
"\\b[A-Za-z0-9._%+-]+@(?!example\\.com)[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b" |
to_or_cc regexpcase
"\\b[A-Za-z0-9._%+-]+@(?!example\\.com)[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b"
color 2 ]
> rule is not account-based
[2023-10-09 16:37:55] checking if message matches [ from regexpcase
"\\b[A-Za-z0-9._%+-]+@(?!example\\.com)[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b" ]
[2023-10-09 16:37:55] checking if message matches [ to_or_cc regexpcase
"\\b[A-Za-z0-9._%+-]+@(?!example\\.com)[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b" ]
> message does not match

Does anyone know what I'm doing wrong?

Thanks in advance.


More information about the Users mailing list