Regex Format Bug?

Sep 17, 2020
315
20
38
Hello All,

I just want to confirm that I'm using the regex correctly, because at times neither of the regex expressions I was using was being able to be tested from within the GUI.

As an example I'm currently using this regex
Code:
(^|^[^:]+:\/\/|[^\.]+\.)domain\.com

But when I go to test it in PMG, it's not working.

If I go to regex101.com and test it, it works like a charm.

Now this may be a new issue within the gui, but a previous regex shared with me here on the forum was
Code:
(\W|^)[\w.+\-]{0,50}@[\w.+\-]{0,50}domain\.com(\W|$)

And it also isn't working.

Any direction appreciated.
 
(^|^[^:]+:\/\/|[^\.]+\.)domain\.com
What are you trying to match with this regex?

* (^|^[^:]+.. - roughly means - beginning of the string, or beginning of the string followed by arbitrary characters which are not ':'
the part with :\/\/ looks like you're trying to match for an URI-scheme (e.g. http://) - which seems odd (unless your mails have headers where someone encodes links inside)

if you want to match addresses coming from (a subdomain of) domain.com - try:
'.+@.*domain\.com'
 
@Stoiko Ivanov
Thanks for the reply.
The 2nd regex was provided to me by someone on the forum.
The first was a more simplified one that worked for either the domain alone, the domain with a sub domain, or even a sub.sub domain since these spammers are doing all of the above.

So one question is, should my regex work in regex101.com ? and if it does, does that work within PMG or am I using the wrong type of regex ( maybe extended type of thing)?

I can't get yours to match either domain.com or www.domain.com in regex101.com, but my first one does work.
My 1st one was working within PMG and tested, but of course we have the temp issue with the regex tester.
 

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!