Watched words regex: word boundary not working as expected

I’ve set up a rule \bass\b and I’m getting inconsistent results:

Shouldn’t just the word “ass” be censored here?

3 Likes

Are we 100% sure the watched words regular expression site setting was flipped to true?

If that is at its default (false) then watched words wouldn’t be regular expressions at all, but also it wouldn’t be matching as it is in your screenshot … so I’m not sure. @neil?

I also can’t repro this on my instance of discourse @awesomerobot :

  • turn on watched words regular expression
  • enter \bass\b in censored section
  • I see correct word boundary only censoring

Just repro’d it on Try. For some reason the word boundary isn’t working when ass and assassin are on the same line. The boundary seems to work fine if I put assassin on a new line.

https://try.discourse.org/t/this-is-a-test-post-with-censored-words/969

3 Likes

Ok there is your repro @neil and @eviltrout I would classify this as a bug for the customer you are working on, too.

2 Likes

This case should be fixed now:

https://github.com/discourse/discourse/commit/dc9723904045a5cf1a3d5f55e34fb582abe73214

8 Likes