regex regular expression for .me domains - ORF Forums

regex regular expression for .me domains RSS Back to forum

1

Hi All. Can I get some help with a regex filter to block all emails containing .me TLDs? I'm getting a ton of email containing links such as http://check.phytonatural-skin-planned.me and I'd like to block them. It needs to block the .me TLD, yet still allow domains such as .me.com and others that begin with .me. It'll take me hours to do what I'm sure someone here can do in minutes. Thanks in advance. Jeff

by Jeff Zell more than 10 years ago
2

btw, I have this regex in my filter list already, but according the test, it doesn't work. Maybe it can be fixed. (?i).*((\.|http://)([a-z0-9]+)(\.(biz|info|us))/)(\?[a-z0-9]+|[a-z0-9]+\?[a-z0-9])

by Jeff Zell more than 10 years ago
3

@Jeff Zell: I think the current regex checks for domain names ending with TLDs .biz, .info, and .us only. You can block domain names in emails ending with .me or .me.com using the following regular expression for example:

.*http://[^\r\n\s]*\.(me|me\.com)(\s|/)

by Krisztián Fekete (Vamsoft) more than 10 years ago
(in reply to this post)

4

In theory, that regex should, but it doesn't work. Or at least it doesn't pass the test when I try examples. I'm not sure where I got it from.

Can I ask for a tweak to the .me regex? Please modify the code so it blocks http://example.me and http://example.me/ -- many of the links don't have the trailing / after the .me part.

Wish I knew regex. Thanks a bunch.

by Jeff Zell more than 10 years ago
5

@Jeff Zell: Try the following:

.*http://[^\r\n\s]*\.(me|me\.com)($|/[^\r\n\s]*|\s).*

This covers six scenarios:

1. links ending with .me
2. links ending with .me.com
3. links ending with .me/
4. links ending with .me.com/
5. links ending with .me/something
6. links ending with .me.com/something

by Krisztián Fekete (Vamsoft) more than 10 years ago
(in reply to this post)

6

@Krisztián Fekete (Vamsoft): I'll give it a try, thanks a bunch.

by Jeff Zell more than 10 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