[SOLVED] Match field syntax to block subject

ljety

Well-Known Member
Oct 25, 2018
56
16
48
I have created a new "what object" for blocked subject list. Inside I made a list with match fields for different subjects. Its look like:

Field: Subject
Value: XXX YYY (subject text)

I put also a new rule under mail filter which should block incoming mails with "blocked subjects". Unfortunately mail filter doesn't block e-mails with blocked subject.

What is the right syntax for match fields? How can I use "wildcards" in "value" field to ignore some parts of subject?
 
Hi,

What is the right syntax for match fields? How can I use "wildcards" in "value" field to ignore some parts of subject?

The match field works with regular expressions, see https://pmg.proxmox.com/pmg-docs/pmg-admin-guide.html#pmg_mailfilter_regex for some introduction to them.

Normally, a wildcard is expressed as .* in regular expressions. I.e., a dot to match any character, and the * repetition to match any repetition from zero (none) to infinity (until something else follows the regex)

For example, to match any subject containing the word "free", then an arbitrary or no string, then "money" you would use:
free.*money

This would match then "free money", "freemoney", "get free, and best, money".

Hope that helps.
 
Thank you Lamprecht, its work! How to use /i for "case insensitivity". I tried with:

free.*money/i for "FrEE MONEY" but without success.
 
The regex you enter here will always be put in /$regex/ context, so passing "global" flags in there isn't possible.

But, for that you could put (?i) at the start of the regex, it is the inline variant of the /i "global" modifier.
 
hello
i have a problem to match this subject :
"Löwen" System macht Deutsche Bürger reich!

i try this, the test is ok but it's not go to quarantine

(?i)0*"L.wen" System macht Deutsche B.rger reich!
("Löwen" System macht Deutsche Bürger reich!)
(System macht Deutsche Bürger reich!)
System macht Deutsche B.rger reich!

this is work
.*System macht Deutsche B.*

but why ü are not match ?
and how to work with "

thanks for help
 
thanks

my subject exemple:

"Löwen" System macht Deutsche Bürger reich!
(?i)"L.*wen" System macht Deutsche B.*rger reich!

AKTIVÉIERT ÄRE MICROSOFT PROFIL !!!
(?i)AKTIV.*IERT .*RE MICROSOFT PROFIL !!!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!