As the title says , I need to find two specific words in a sentence. But they can be in any order and any casing. How do I go about doing this using regex?
For example, I need to extract the words test
and long
from the following sentence whether the word test
comes first or long
comes.
This is a very long sentence used as a test
UPDATE: What I did not mention in the first part is that it needs to be case insensitive as well.
(\b(james|jack)\b.*){2,}
. Unlike lookaround or mode modifier, this works in most regex flavours. – Susumu