[Rspamd-Users] Regex in Multimap does not work

Gerald Galster list+rspamd at gcore.biz
Fri Nov 19 13:19:42 UTC 2021

>> i have a multimap for my headers to add score 8, if regex matches.
>> Rule is defined in /etc/rspamd/local.d/multimap.conf
>>   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
> \b

Just to elaborate, \b means boundary. It's not a char, it's the
transition from a word-character to a non-word-character or vice

/\bauftrag/ does not match e.g. /Beauftragter/ although it contains
"auftrag" because the boundary is missing.

\b     Match a \w\W or \W\w boundary

\w     Match a "word" character (alphanumeric plus "_", plus
       other connector punctuation chars plus Unicode marks)

\W     Match a non-"word" character


In case you use hyperscan, keep in mind it has not all the feature
of pcre (subexpressions, ...).


Or you might try

/^Subject: auftrag Apotheke/

Best regards,

More information about the Users mailing list