[Rspamd-Users] Regex in Multimap does not work

Andreas Wass - Glas Gasperlmair a.wass at glas-gasperlmair.at
Tue Nov 30 12:24:59 UTC 2021


i did a few tests and in this article
https://rspamd.com/doc/modules/multimap.html#regexp-maps
is a link to

http://intel.github.io/hyperscan/dev-reference/compilation.html#pattern-support
and below "Supported Constructs" are also anchors ^ and $

so why does these expressions not matching to following line

Subject: Re:

/Subject: Re:\z/ MY_OWN_SYMBOL:8
or
/Subject: Re:$/ MY_OWN_SYMBOL:8
or
/^Subject: Re:$/ MY_OWN_SYMBOL:8

the following applies, but also if there is something after Re:

/Subject: Re:/ MY_OWN_SYMBOL:8

So, how can i match strings with rspamd, ending with in this case "Re:" ?

best regards, Andi

Am 30.11.2021 um 11:19 schrieb Andreas Wass - Glas Gasperlmair:
> sorry, text got lost at last reply:
>
> string i'm not able to match. I got a lot emails with Subject exactly 
> like following line
>
> Subject: Re:
>
> what i tried and works fine at https://regex101.com/...
>
> /Subject: Re:\z/i MY_OWN_SYMBOL:8
> /Subject: Re:\$/i MY_OWN_SYMBOL:8
>
> .. is not working in rspamd
>
> thx for helping me
> Andi
>
> PS: (i know, that there is a better map type for that, but regex 
> should work also in this i guess)
>
> Am 30.11.2021 um 11:01 schrieb Andreas Wass - Glas Gasperlmair:
>> maybe i'm not using the right map, but regex should work here too, 
>> right?
>>
>> Am 30.11.2021 um 10:49 schrieb Vsevolod Stakhov:
>>> On 19/11/2021 11:58, Andreas Wass - Glas Gasperlmair wrote:
>>>> Hi All,
>>>>
>>>> i have a multimap for my headers to add score 8, if regex matches.
>>>> Rule is defined in /etc/rspamd/local.d/multimap.conf
>>>>
>>>> MY_OWN_SYMBOL {
>>>>    type = "content";
>>>>    filter = "headers"; # can be headers, full, oneline, text, rawtext
>>>>    map = "${LOCAL_CONFDIR}/local.d/gasp_scoring_subject.map";
>>>>    description = "Gasperlmair Scoring-Header";
>>>>    regexp = true;
>>>>
>>>> I want to match following string in subject (beginning with the word
>>>> auftrag)
>>>> auftrag Apotheke
>>>>
>>>> but the following regex does not match the string auftrag Apotheke
>>>>
>>>> /^auftrag Apotheke/ MY_OWN_SYMBOL:8
>>>>
>>>> It only works, if i'm not using ^ but then it also matches words
>>>> beginning with  ...auftrag (for Example)
>>>>
>>>> Thx for helping
>>>
>>> You also use the incorrect map type. You should apparently use the
>>> `header` map type for your purposes.
>>
>



More information about the Users mailing list