# A closing round bracket breaks word censoring

**URL:** https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782
**Category:** Bug
**Created:** [28 Abril, 2017 15:09 UTC](https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782 "2017-04-28T15:09:08Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![rizka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rizka/32/79717_2.png) [@rizka](https://meta.discourse.org/u/rizka)
#### Post date: [28 Abril, 2017 15:09 UTC](https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782/1 "2017-04-28T15:09:08Z")

</div>

I have recently been working on word censoring patterns to block some Finnish language expressions.

> [@How to use Discourse regexes with watched words?](https://meta.discourse.org/t/could-someone-tell-me-about-discourse-regexes/61522):
>
> I’ve worked on censoring the most vulgar swear words with regular expressions today. Why regexes? Well, in Finnish and other Uralic languages like Hungarian and Estonian words are inflected. A single swear word could have maybe thousands of mutations, which is why it is awesome to have the ability to use regex patterns. It is also no coincidence that it was another Finn who proposed this originally. I need some quick advice about which regex flavor Discourse uses. I experience some unexpected…

In the process, we discovered something I consider as a bug. I can reproduce it with censored words and censored patterns. Steps:

1. Go to /admin/site\_settings/category/posting.
2. Scroll down and locate censored words and censored patterns.
3. Censor something if you already haven’t.
4. Open editor and write something nasty. You will see it censored like this: ■■■■■.
5. Type a closing bracket ). Every censored word which precedes the bracket will show!

The closing bracket appears for instance in the common smiley `:)` which is converted to the respective emoji of course. So if you end your post with `:)`, you can actually type anything you want without any censorship!

If it is not a real bug, feel free to merge these topics. 🙂

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [28 Abril, 2017 19:47 UTC](https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782/2 "2017-04-28T19:47:24Z")

</div>

Yeah, I can reproduce. I added a nonsense word to my censored word lists. As one post:

> [@](#):
>
> This is a censorted word test. gitorcz should be centsored. works
> 
> (gitorcz) not censored.

➡

> [@](#):
>
> This is a censorted word test. ■■■■■■■ should be centsored. works
> 
> (gitorcz) not censored.

But without the `(` before the second _gitorcz_, both instances are not censored.

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [13 Septiembre, 2017 17:15 UTC](https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782/3 "2017-09-13T17:15:26Z")

</div>

Warning - dirty language follows. Are there any cencored words here?

Edit: Oops. At least not the most common curse words are cencored. I was trying to repro this issue here as this bug report is still valid in the 1.8 stable branch.

---

<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: [13 Septiembre, 2017 17:26 UTC](https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782/4 "2017-09-13T17:26:04Z")

</div>

The censored words setting has been moved to a new UI “Watched Words” in 1.9. The censored patterns setting still exists, but the Watched Words lists can use `*` as a wildcards in the words. `p*k` for pork and punk.

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [13 Septiembre, 2017 18:11 UTC](https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782/5 "2017-09-13T18:11:50Z")

</div>

Thanks for the update. The bug report is about going around the word filter by using a round bracket, like the basic smiley:

```
:)

```

Have these changes a positive impact on this glitch?

---

<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: [13 Septiembre, 2017 20:49 UTC](https://meta.discourse.org/t/a-closing-round-bracket-breaks-word-censoring/61782/6 "2017-09-13T20:49:26Z")

</div>

I believe that short of moderation, no 100% censoring is currently possible.

A while back I experimented with trying different ways to get by the filter to post working censored links. With my admitted limited attempts I was very satisfied with the results - _in terms of breaking censored links_

In terms of words there are at least several ways to convey words or their meaning despite the censored word filtering. For example, I can type WHAT is this **!#^\*!** and many would substitute the word themselves.

Anyway, AFAIK, the code of interest is  
[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/censored-words.js.es6](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/censored-words.js.es6)
