# Email domain blacklist with wildcards (revisited)

**URL:** <https://meta.discourse.org/t/email-domain-blacklist-with-wildcards-revisited/70088>\
**Category:** Feature\
**Created:** [September 15, 2017, 2:37am UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards-revisited/70088 "2017-09-15T02:37:40Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)\
**Post date:** [September 20, 2017, 2:44am UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards-revisited/70088/3 "2017-09-20T02:44:19Z")

</div>

I’ve tried it with the following blacklist domain:

`\d+\d\d\d.\w+`

which should match any domain which is made up of four or more numbers (and numbers only).

I checked the setting with [Data Explorer](https://meta.discourse.org/t/32566?silent=true) and confirms that `email_domains_blacklist` is `	mailinator.com|cc|\d+\d\d\d.\w+`, which is correct.

The code `regexp = Regexp.new("@(.+\.)?(#{domains})", true)` should now filter off emails coming from domains with long digits.

EDIT: Note: not sure what the second parameter `true` is doing in a call to `Regexp.new()`, which takes as a second parameter the matching options.

However, I just had three new SPAMmers came through:

```plaintext
ddef@445555.com
mnopp@89990001.com
gg5@996399.net

```

So obviously it is not working.

Trying the RegExp in a JavaScript console confirms that it works:

```plaintext
/@(.+\.)?(mailinator\.com|cc|\d+\d\d\d\.\w+)/.test("ddef@445555.com")
true

```

There, the domain blacklist is not working as it should.

---

_[View the full topic](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards-revisited/70088)._
