# Support for wildcards in word censoring

**URL:** https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866
**Category:** Feature
**Created:** [27 maart 2015 om 08:50 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866 "2015-03-27T08:50:44Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![tonninseteli](https://avatars.discourse-cdn.com/v4/letter/t/eada6e/32.png) [@tonninseteli](https://meta.discourse.org/u/tonninseteli)
#### Post date: [27 maart 2015 om 08:50 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/1 "2015-03-27T08:50:44Z")

</div>

I don’t know if anyone actually uses this for other than fun but due to inflection it would be nice to be able to use wildcards when adding censored words.

---

<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: [27 maart 2015 om 13:49 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/2 "2015-03-27T13:49:21Z")

</div>

I could see this leading to too many false positives but it could be nice in some cases.

---

<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: [27 maart 2015 om 20:20 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/3 "2015-03-27T20:20:16Z")

</div>

This was intentionally not supported when the feature was added to avoid people making poor ■■■umptions, or talking about a topic’s ■■■le, or the town of S■■■■horpe, or medireview weapons.

---

<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: [27 maart 2015 om 21:16 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/4 "2015-03-27T21:16:21Z")

</div>

Wouldn’t happen if someone was thorough with their regex though 🙂

---

<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: [27 maart 2015 om 21:38 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/5 "2015-03-27T21:38:07Z")

</div>

The potential for disaster is just too high. People aren’t “good” at regex.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [27 maart 2015 om 23:36 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/6 "2015-03-27T23:36:37Z")

</div>

Agreed 300+%

If you’re working with a limited set of possible variations, say,file or Category names, or maybe even Discourse table names, then coming up with a working regex is possible.

But if you’re talking about anything that might possibly be entered by anyone into a post, your working regex is much simpler.

It’s  
`/(.)*/`  
😉

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [9 november 2016 om 23:01 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/7 "2016-11-09T23:01:48Z")

</div>

Hey look what we added this week:

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/5/3/c536196aac8b6aa7b0a877e4ef0f92634caa0e2b.png)

This is a new setting that works alongside `censored words`, but is a regular expression. The above example filters 7 digits of a phone number. If you like it, call me at 555-1234!

The value entered in the setting is checked to see if it matches too greedily like `(.)*`. Also, if cooking a post ever fails because the javascript engine timed out, then the `censored pattern` setting will be cleared on the assumption that it’s an evil regex like `(a|aa)+`.

---

<div class="post-metadata">

### Author: ![boxels](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/boxels/32/65118_2.png) [@boxels](https://meta.discourse.org/u/boxels)
#### Post date: [13 december 2016 om 23:52 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/8 "2016-12-13T23:52:53Z")

</div>

Anyone have any guidance on newbies using regex patterns? Can you do more than one? does a list like this work, if so how do we enter it to make each word work?

> <https://pastebin.com/tcNWpHjg>

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [14 december 2016 om 00:37 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/9 "2016-12-14T00:37:52Z")

</div>

> [@boxels](#):
>
> Anyone have any guidance on newbies using regex patterns?

Yes, if you don’t know what you’re doing, don’t do it on a live site.

I find that [https://regex101.com](https://regex101.com) can be good for testing. I don’t know if the input takes an array of patterns. But 304 of them would make for one very long pattern which the input may not take either. For that many, I have a feeling a plugin might be best.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [14 december 2016 om 02:55 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/10 "2016-12-14T02:55:20Z")

</div>

That list would go into the `censored words` list and not on the `censored pattern`.

---

<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: [15 december 2016 om 02:26 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/11 "2016-12-15T02:26:46Z")

</div>

Also, it’s probably a bad idea to censor the word “admin” @boxels. That probably goes in “disallowed usernames” instead (where it already is).

---

<div class="post-metadata">

### Author: ![easylocarb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/easylocarb/32/120327_2.png) [@easylocarb](https://meta.discourse.org/u/easylocarb)
#### Post date: [16 december 2016 om 02:16 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/12 "2016-12-16T02:16:05Z")

</div>

It can be defeated by typing in a\< i\>\< /i\>ss

---

<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: [16 december 2016 om 02:34 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/13 "2016-12-16T02:34:22Z")

</div>

Well yes there are dozens of ways to defeat word censoring. That is not the point of it though.

---

<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:23 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/14 "2017-05-16T19:23:08Z")

</div>

Can there be more than one regex? It doesn’t seem to let you have multiples like `permalink normalizations`, for example.

I’ve a client who’d like phone numbers and emails hidden.

Edit: No, but you don’t need that, just use a `|`.

`\d{3}-\d{4}|[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+` will censor email addresses and xxx-yyyy phone numbers.

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [16 mei 2017 om 19:36 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/15 "2017-05-16T19:36:13Z")

</div>

> [@codinghorror](#):
>
> The potential for disaster is just too high. People aren’t “good” at regex.

> [@pfaffman](#):
>
> \d{3}-\d{4}|[\w+-.]+@[a-z\d-]+(.[a-z\d-]+)\*.[a-z]+ will censor email addresses and xxx-yyyy phone numbers.

It will also sensor text after an email address on the same line:  
 ![](https://global.discourse-cdn.com/meta/original/3X/6/f/6f967c9798ffa0b068363247cacacb8ed4b9628e.png)

EDIT: I see an edit in there now 🙂

---

<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: [9 juli 2018 om 16:06 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/16 "2018-07-09T16:06:45Z")

</div>

This is now at /admin / logs /watched words /censor

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [4 december 2025 om 11:35 UTC](https://meta.discourse.org/t/support-for-wildcards-in-word-censoring/26866/17 "2025-12-04T11:35:48Z")

</div>


