Parenthesis are not blocked when used as Block-words in settings

(Anton) #1

I added the following words which should block message submission:

However, people are still able to submit topics and replies containing )))

(Jeff Atwood) #2

Hmm, perhaps a regex escaping issue @neil?

(Neil Lalonde) #4

The escaping is correct.


But those “words” are made up entirely of word boundaries. If you use parens in a word like co(onut, we can match it. But not if we can’t differentiate word boundaries from the word you want to match.

(Anton) #5

Can we make it possible for admins to add their own regex?

Or improve the existing regex in the code so that words can be entirely made of punctuation symbols.

(Neil Lalonde) #6

Yes, you can use the censored pattern site setting instead of watched words.

(Anton) #7

It does not solve the issue.

Firstly, censored pattern will still allow users to post, but will replace the tokens with ■ ■ ■ ■. While what I wanted is to stop message from being posted.

Secondly, it would be difficult to maintain a single regex that manages multiple words.

Would it be possible to improve the existing mechanics so that it does not rely in word boundaries only?

One possible solution is to make an additional if check and apply a different regex for words starting with / ending with symbols that also make word boundaries. E.g. “(coconut” or “coconut)” or “)))

(Neil Lalonde) #8

I think you’re using the word watching to do something it wasn’t designed to do. Are you trying to educate your users about writing better quality posts? They’re using )))) a lot and you’d rather they didn’t? Sounds more like the “title prettify” setting, but for all posts.

(Anton) #9

Correct @neil, but they’re using ))) and )))) and ))))) and so on too much, and not just in titles, but rather in text.

I’ve been trying educating and asking in private messages and many other things, but nothing helped. So I decided the try blocking messages from being posted.

Now, considering the UI is there already, why is it not acceptable to improve the existing mechanics so that ))) are recognized as well as words?

(Mittineague) #10

Maybe you could get harsh and use a regex to change any post with an arbitrary number of sequential parentheses so that the entire post gets replaced.

(Austin Grelle) #11

Is censored patterns still available? I can’t find it anywhere in v.2.0.0.beta6+97.


Yup, it’s in Logs > Watched Words

(Austin Grelle) #13

Thanks for the help, when I go to this I just see the censored Word input. I tried putting in a regex but got an error.

(Kane York) #14

You probably need to escape the parenthesis, like this:


(Austin Grelle) #15

Thanks I will keep trying. I have a regex that I like on this link Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript and I have tried a few permutations of () juggling but can’t get it to load to admin.

Are there any limits on the length of the word or regex?

(Neil Lalonde) #16

If you want the words to be regexes, then you need to enable the “watched words regular expressions” setting.

(Kane York) #17

Based on the difficulties in the other recent topic, it might be a good idea to upgrade that site setting to a per-watched-word setting. :thinking:

(Austin Grelle) #18

Thanks Neil and Kane this setting does the trick for regex. The next question then is there any way to allow more than 50 characters for regex?