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.somedomain.com. For example mail1.somedomain.com or mail-gate.somedomain.com

Thank you

Anyone?

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 :wink:

Regards
Leffe (Blueforce)

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.