Help with regex expression - ORF Forums

Help with regex expression RSS Back to forum

1

I get bombarded with various spam with addresses that are very similar, but different enough that a simple expression won't work. I would like to create a regex expression and was wondering if someone could help me with it.

Below are examples of some of the spam email addresses.

bounce-9623-3683935215-josh=
bounce-9526-4728708521-josh=
bounce-9565-4728307071-josh=
bounce-9389-3683935215-josh=
bounce-9197-4728307071-josh=

As you can see they all start with "bounce-9", have a specific number of digits, a hyphen, again and specific number of digits, a hyphen, a connotation of my email address (I've removed my actual email address), and then a changing domain.

I was thinking of setting up a sender blacklist that starts with "bounce-9", checks for a specific number of digits before the hyphen, checks for the hyphen, again checks for a specific number of digits after the hyphen, then checks for a hyphen and the email address string, and the domain would be the wild card.

Can a regex expression be setup to do what I'm wanting to do?

Thanks
Josh

by Josh 6 years ago
2

Try the following one:

bounce-9\d{3}-\d{10}-josh=address\[email protected]*

by Krisztián Fekete (Vamsoft) 6 years ago
3

Thanks Krisztian!

I'll give that a shot, but from the initial checks it looks like it'll work.

Josh

by Josh 6 years ago
4

@Josh: Glad to hear it works :)

by Krisztián Fekete (Vamsoft) 6 years ago
(in reply to this post)

New comment

Fill in the form below to add a new comment. All fields are required. If you are a registered user on our site, please sign in first.

It will not be published.
hnp1 | hnp2