I am trying to highlight sentences that contain a given word. Let's say for this example that the word is "lorem". To me a sentence can end multiple ways, for example, it can end with one of the following characters: "," "!" "." "?". This can be done very easy with the following regex:
/\b((?!=|\,|\.).)+(.)\b/gim
Previous I used /^.*lorem.*?(\.|\!|\?)/gim
to match sentences containing the word "lorem". But this did not work most of the time as expected. Is there any way I can use the new regex that separates sentences to only match sentences with a given word?
Just a heads up. I understand that this could be accomplished using javascript functions like replace. However, this is not an option. Our custom system, where this regex is going to be used only accepts regex as input.