Замените символ, если ему предшествует и с последующим словом символ JS

This Works to find when a word is followed by another chars
string.match(/word([^s]|^)/) 

You can use ([^s]|^) before or after the word.

Cases: 
If the word has other char/word before it the code is:
string.match(/([^s]|^)word/)
If the word has other char/word after it the code is:
string.match(/word([^s]|^)/)
Sergiu The Man