Support for wildcards in word censoring

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.


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

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.


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

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


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.


Hey look what we added this week:

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)+.


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?

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

I find that 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.


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


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


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

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

1 Like

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.

It will also sensor text after an email address on the same line:

EDIT: I see an edit in there now :slight_smile:


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