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.
Use a capturing group if you want to extract the matches:
(test)|(long)Then depending on the language in use you can refer to the matched group using $1 and $2, for example.