FIX: Do not replace watched words in mentions and hashtags (PR #14260)

Watched words of type ‘replace’ or ‘link’ replaced the text inside mentions or hashtags too, which broke these. These types of watched words must skip any match that has an @ or # before it.


I think we need to test for the actual content here. If there is a bug that accidentally replaces @test with @discourse I think this assertion will still pass.

That’s not true because the output will be @discourse #test discourse and discourse will be twice in the output.

This pull request has been mentioned on Discourse Meta. There might be relevant details there: