# Is there any way I can automatically censor email addresses on posts?

**URL:** https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407
**Category:** Support
**Created:** [19 februari 2015 om 15:50 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407 "2015-02-19T15:50:19Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![rodrigofarcas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rodrigofarcas/32/69085_2.png) [@rodrigofarcas](https://meta.discourse.org/u/rodrigofarcas)
#### Post date: [19 februari 2015 om 15:50 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/1 "2015-02-19T15:50:19Z")

</div>

We don’t want users posting emails. Is there a way to achieve this?

Thanks!!

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [19 februari 2015 om 15:56 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/2 "2015-02-19T15:56:37Z")

</div>

We do have a censoring mechanism, but it’s based on words.

Your best bet would be to write your own plugin 😉

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [19 februari 2015 om 16:00 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/3 "2015-02-19T16:00:32Z")

</div>

Also could you just make it a site rule not to do that? And have moderators remove it if it happens?

We haven’t had a problem here with people posting many email addresses.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [19 februari 2015 om 16:58 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/4 "2015-02-19T16:58:49Z")

</div>

It’d also be a problem when allowing anonymous emails into the a new topic … the sending email address is posted above the incoming message.

---

<div class="post-metadata">

### Author: ![rodrigofarcas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rodrigofarcas/32/69085_2.png) [@rodrigofarcas](https://meta.discourse.org/u/rodrigofarcas)
#### Post date: [19 februari 2015 om 17:15 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/5 "2015-02-19T17:15:33Z")

</div>

yeah, it is a Pets site, and people start posting their emails about free dogs or cats, which are usually fake. We delete them manually, but still would be good to have an automatic rule for emails.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [20 februari 2015 om 01:23 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/6 "2015-02-20T01:23:44Z")

</div>

If you can teach your community to flag these posts as spam when they see them, I think you’ll be pleasantly surprised at how easy it becomes 😄

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [16 mei 2017 om 19:28 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/7 "2017-05-16T19:28:27Z")

</div>

censored pattern = `\d{3}-\d{4}|[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+`

will censor xxx-yyyy phone numbers and email addresses.

---

<div class="post-metadata">

### Author: ![Eric\_M\_Carty\_Fickes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eric_m_carty_fickes/32/119850_2.png) [@Eric\_M\_Carty\_Fickes](https://meta.discourse.org/u/Eric_M_Carty_Fickes)
#### Post date: [13 juni 2018 om 15:52 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/8 "2018-06-13T15:52:37Z")

</div>

Does the above pattern work for anyone else? I tried entering it and got a “Sorry, an error has occurred.” alert. Even with just `\d{3}-\d{4}` and regular expressions turned on, it doesn’t block 123-1234 in a post. Was there a change, or am I doing something wrong? Thanks!

---

<div class="post-metadata">

### Author: ![Daniel\_Nevoigt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniel_nevoigt/32/92920_2.png) [@Daniel\_Nevoigt](https://meta.discourse.org/u/Daniel_Nevoigt)
#### Post date: [13 juni 2018 om 18:20 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/9 "2018-06-13T18:20:58Z")

</div>

> [@pfaffman](#):
>
> censored pattern = `\d{3}-\d{4}|[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+`

Where do I enter that?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [13 juni 2018 om 19:07 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/10 "2018-06-13T19:07:35Z")

</div>

It moved.

Navigate to /Admin/logs/watched words

---

<div class="post-metadata">

### Author: ![cmwebdev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cmwebdev/32/122368_2.png) [@cmwebdev](https://meta.discourse.org/u/cmwebdev)
#### Post date: [13 juni 2018 om 19:23 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/11 "2018-06-13T19:23:16Z")

</div>

I think you also need to enable the option regex for watched words in the settings.

---

<div class="post-metadata">

### Author: ![Daniel\_Nevoigt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniel_nevoigt/32/92920_2.png) [@Daniel\_Nevoigt](https://meta.discourse.org/u/Daniel_Nevoigt)
#### Post date: [14 juni 2018 om 05:20 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/12 "2018-06-14T05:20:18Z")

</div>

Doesn´t aceept the expression, to long, error says maximum 50 signs. I tried to enter it in censuring

---

<div class="post-metadata">

### Author: ![ashledombos](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ashledombos/32/114818_2.png) [@ashledombos](https://meta.discourse.org/u/ashledombos)
#### Post date: [28 juni 2018 om 08:54 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/13 "2018-06-28T08:54:10Z")

</div>

> [@Daniel\_Nevoigt](#):
>
> error says maximum 50 signs

I’d like to express my support to anyone who could fix this “issue” too: previously the official [RFC 5322](http://emailregex.com/) (426 characters) [could be entered](https://meta.discourse.org/t/protect-forum-against-email-harvesters-bots/62760/2) to hide any email address. Now it’s only 50 characaters max.

Maybe now there is another better way to obfuscate email addresses (especially to crawlers)?

---

<div class="post-metadata">

### Author: ![sirideain](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sirideain/32/101202_2.png) [@sirideain](https://meta.discourse.org/u/sirideain)
#### Post date: [28 juni 2018 om 16:10 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/14 "2018-06-28T16:10:17Z")

</div>

I second the idea of increasing the character limit here. Regular expressions can easily get past 50 characters.

For the watch words, it would also be nice to have a description field so when there is a regular expression in there, it is easy to know what it should be doing.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [18 januari 2021 om 15:20 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/15 "2021-01-18T15:20:00Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [19 januari 2021 om 22:07 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/16 "2021-01-19T22:07:47Z")

</div>

I believe we recently increased the limit from 50 chars to 100 chars here, does anyone else recall?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [19 januari 2021 om 22:37 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/17 "2021-01-19T22:37:57Z")

</div>

Looks like it’s 100 now. The prompt is now “new word”:

 ![image](https://global.discourse-cdn.com/meta/original/3X/3/a/3a133ca8b79da81aab5bad7559cc17ced9273b78.png)

---

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [23 augustus 2021 om 15:55 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/18 "2021-08-23T15:55:35Z")

</div>

I don’t know if this has changed since January but this appears to only half work when the `enable markdown linkify` setting is enabled.

The regular expression works perfectly to censor the text but an email address is parsed and turned into a mailto link first, exposing the email address in the HTML.

E.g.

```plaintext
<a href="mailto:someone@example.com">■■■■■■■■■■■■■■■■■■■</a>

```

---

<div class="post-metadata">

### Author: ![acorrea](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/acorrea/32/302650_2.png) [@acorrea](https://meta.discourse.org/u/acorrea)
#### Post date: [25 april 2023 om 19:08 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/19 "2023-04-25T19:08:19Z")

</div>

How to do that? I could not find anywhere for enabling regex – if I try to use them anyway it does not work.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [25 april 2023 om 20:14 UTC](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407/20 "2023-04-25T20:14:04Z")

</div>

The setting name is **watched words regular expressions** 🙂

[Next page](https://meta.discourse.org/t/is-there-any-way-i-can-automatically-censor-email-addresses-on-posts/25407.md?page=2)
