Home > Blockchain >  Regex for cpanel email filtering of .co domains without matching .co.uk
Regex for cpanel email filtering of .co domains without matching .co.uk

Time:10-10

I'm getting a lot of spam from addresses with the suffix .co so figured a quick cpanel email filter using regex would do the job, but my regex isnt great and it matches .co and anything that starts with .co including .co.uk etc..

How can i make it stop matching at the o of .co

This is what i used: (?i).co.*?

Thanks.

(Just for context, i am using the cpanel email filter setting 'From' 'matches regex')

CodePudding user response:

You can target emails with .co but not with .co.uk, .co.in, etc like this:

(?i).co$

Check this link for a practical example of the above Regex.

  • Related