Mulitple words in any order using regex

Posted by RC1140 on Stack Overflow See other posts from Stack Overflow or by RC1140
Published on 2009-07-24T11:30:56Z Indexed on 2011/03/07 0:10 UTC
Read the original article Hit count: 135

Filed under:

As the title says , i need to find 2 specific words in a sentence. But they can be in any order and any casing. How do i go about doing this using regex.

E.g. This is a very long sentence used as a test

From that sentence i need to extract the words test and long in any order i.e. test can be first or long can be first.

UPDATE: What i did not mention the first part is it needs to be case insensitive as well

© Stack Overflow or respective owner

Related posts about regex