I want to get a regex which can tell if two given words are in one sentence (word order matters). The problem is that I can have a contraction in a sentence, so the period doesn’t indicate that there’s the end of the sentence. The part of regex which indicates the end of the sentence is
\\.(\s+[A-Z]|\s*$)
What would the pattern look like?
You could use this:
This basically says, match and capture a word, then anything that is not a period, or a period followed b a space, any number of times, and finally match and capture another word.
EDIT: For given words in either order, use: