2.7.0.beta7 Auto-tag and auto-replace

Hi there, firstly, I like the Auto-tag and auto-replace functionality, Thanks for including it.

This is not a major bug by any means, but just to highlight

with the test functionality

if you use a compound word or a “word in a word” for example
The “New Word” Term
and the “Replacement” as Semester

In the test window, typing the word aftermath term is not highlighted, however in a post, it will show as afSemesterath

and a hyperlink would have a similar issue and would display as similar to this

Apologies in advance, as a new user I can only embed one image, so this may be a little out of context as I joined my 3 images together

As a couple of seperate requests
Would there be the possibility to add case sensitivity as an option :heavy_check_mark: to the Auto-tag and auto-replace

I can see that this would be less common, but I personally have a Number of uses for it.

Also the ability to edit the the “New words” rather than having to delete and re-adding them

Thanks in advance for your time and reply

1 Like

This bug is definitely happening, thank you for the report @pilgrimsmaster

Priority/Severity: I don’t think it’s too severe, but it definitely could cause an impact. Any section of a word that matches gets replaced, it doesn’t affect only compounds but any word.

Platform: Tested it in Discourse version 2.7.0.beta7, in safe-mode.

Description : When a section of a word matches a “watched word” it is replaced by the “replacement”, making the original word loose its meaning. For example, if ask is a watched word that should be replaced by question, and I type basketball in my topic, it will be replaced by bquestionball.

Reproducible steps:

Create a topic with any long word, for example sunglasses:

Go to Admin → Customize → Watched Words → Replace. Add a section of the previous word as a watched word (for example glass) and add any other word as replacement (friend in this case):

Go back to the previous topic and you should see the word was modified. It says sunfriendes in this example:

When testing in the settings, it works correctly:

Screenshot_2021-04-17 Admin - Constanza's Discourse(3)

Note: someone pointed out here Where is auto-tag and auto-replace? - #7 by techAPJ that the feature doesn’t work in titles, which is true as you can see in the previous example. But that is a different issue.



I appreciate the prompt and thorough reply.

Any thoughts on the other 2 “Requests”

Thanks again :+1:

1 Like

@pilgrimsmaster I found this post: Could someone tell me about Discourse regexes? - #9 by justin

As suggested there, you could use regex to solve the issue we’ve been discussing here. Check @justin comment at the end of the topic.

First enable regular expressions for watched words in your site’s settings.

Then add a regular expression that matches the word you want to replace. Use word boundaries (\b) so it matches the word when it’s between non-characters (like spaces). You can test your expressions here: https://regexr.com/39nr7

Screenshot_2021-04-17 Admin - Constanza's Discourse(5)


Thank you very much for that, I don’t think I would have found that on my own.
I appreciate your time and effort