Help with Greylisting regex please?

4 posts / 0 new
Last post
#1 Fri, 11/11/2016 - 04:05
netizen

Help with Greylisting regex please?

Hello,

I am struggling with regex syntax for mail greylisting and I don't find the online help very useful. Can you please help?

What is the difference between those two below (assuming they are correct..)?

^mail\d+\.somedomain\.com$
and
^mail.*\.somedomain\.com$

My aim is to whitelist any mail server that matches mail<anything>.somedomain.com. For example mail1.somedomain.com or mail-gate.somedomain.com

Thank you

Mon, 11/14/2016 - 05:36
netizen

Anyone?

Wed, 11/16/2016 - 10:52
Blueforce

Hi,

I'm using the same format as in your second example to accomplish the same that you want to do. And I think \d represents a digit and \d+ one or more digits... but i'm not an expert ;)

Regards Leffe (Blueforce)

Wed, 11/16/2016 - 22:06
applejack

To test regular expressions below use "grep -e" from the command line. If you see the hostname echo'ed the regex worked. For example:

echo 'mailanything.123.somedomain.com' | grep -e '^mail\S*\.somedomain\.com$'

or in case it is not .com but say .co.uk

echo 'mailanything.123.somedomain.co.uk' | grep -e '^mail\S*\.somedomain\.\S*$'

Take a look at https://regex101.com but test out on the command line as above.

Topic locked