I am trying to replace all occurrences of a word unless the word is at the end of the sentence, for example:
The quick brown fox jumps over the lazy dog
If I am removing the word dog, the above sentence should remain the same,
The quick brown fox jumps over the lazy dog
but if the sentence was:
The dog was lazy
dog would be removed from the sentence and would have the following result;
The was lazy
I am not well versed with regex I tried something like this;
(dog)(?=(dog))
Apparently this is wrong, because it does not remove any.