Watched Words - Is there a way to block the use of asterisks with certain words instead of it being used as a wildcard?

I did a little search-fu and couldn’t find the answer, but I apologize if this has already been answered somewhere.

Short version, we have a few users who instead of using a watched word, work around the system by posting it with asterisks. For example, they say “f**k.” We attempted to add that to Watch Words but it started blocking anything that started with f and ended in k, such as feedback, firetruck, and Frederick.

Is there a way to add something like that above to Watched Words where it only looks for that specific phrase and does not treat it as a wildcard?

2 Likes

I haven’t tried it, but escaping with backslashes like f\*\*k should probably work.

3 Likes

Seems to work. Thanks for the tip. :slight_smile:

2 Likes

Hmm, nope… spoke too soon. That doesn’t block Frederick, but it also doesn’t block f**k.

1 Like

I think it works there, so I would expect it to work in Discourse too. I am curious as to why this is not the case.

2 Likes

I’m assuming this means that regex has to be turned on, correct?

We are using a hosted version, and a little search-fu lets me know that I should reach out to the team and see if that is turned on.

1 Like

Looks like a site setting needs to be turned on


Edit after turning regex on it still sees “*” as a wildcard.

3 Likes

But it doesn’t. Discourse sees f\*\*k literally. So it works if an user really writes f\*\*k.

2 Likes

That’s right. :+1: That setting is disabled by default and would need to be toggled on by us for our hosted sites. Let me know if that’s something you’d like us to do. :slight_smile:

I think if you do swop over you may need to convert all of your existing watched words into the regex format and reapply them.

The regex can be trickier to nail down than the simplified version but can be more versatile as long as you get the regex expression right. For this, you’d want something that could identify multiple workarounds (f**k, f%ck, f&@k, fu<bla>ck). Though catching them all can be a game of whack-a-mole (especially if someone is deliberately trying to sidestep the word block rather than use it as a guide of what is/isn’t acceptable).

4 Likes

I’m curious — in generally, how can I watch word f**k? Let’s don’t care all variants etc, but how can I tell * isn’t a wildcard but a character? Escaping doesn’t work.

2 Likes

Toggling on watched words regular expressions and adding f\*\*k to Block seems to work for me? Are you testing with a regular user or an admin? Actually, Block works on admin too.

3 Likes

As an admin. But as I said in other topic, this is one of those days, and I reckon yesterday was equally bad — I didn’t tell to system it was a regular expression.

I need more coffee.

1 Like

Side note, be careful if you have other watched words too and you enable regex it will affect all word added to the list. It means you have to change the word boundaries to avoid partial matches.

8 Likes