A bit hard to phrase this in english for me, but I hope you'll understand what I'm trying to do.
This script is a part of my chat handler https://paste.denizenscript.com/View/114897. It highlights every keyword I have defined in lists with color or other stuff, if the message contains a keyword.
At the end, I have a choose command where I do specific commands/hovers for different keywords I defined in a list.
The goal is to have words like rules, support, etc. be highlighted in chat and also have a command run when clicked.
Right now this works fine BUT in german you can conjugate words to act as verbs, which lets them end with an "en". So I want to highlight the word "support" when someone writes the word support as is in the chat, but not if it is part of another word that got conjugated or sth. (like in supportING, or supprtEN). This problem also applies to the other tests where I find matches to player names, or server locations.
So TL;DR my keywords should only be highlighted if they begin with a space and end with a space OR if they end with punctuations like ?,:!,etc.
Example:
someword abcdefKEYWORDblabla someword. - should not be highlighted
someword KEYWORD someword - should be highlighted
someword KEYWORD! - should be highlighted (but only the keyword, not the exclamation mark)
someword !KEYWORD someword - should not be highlighted