Using regexp to search for the string matching multiple words arranged in random.

Posted by t.sim on Stack Overflow See other posts from Stack Overflow or by t.sim
Published on 2010-04-02T05:56:33Z Indexed on 2010/04/02 6:03 UTC
Read the original article Hit count: 399

Filed under:

How can I write the regexp to match multiple words in random order?

For example, let's assume the following lines:

Dave Imma Car Pom Dive
Dive Dome Dare
Imma Car Ryan
Pyro Dave Imma Dive
Lunar Happy Dave

I want to search the string for the one matching "Dave" "Imma" and "Dive", expecting the 1st and 4th line. Is this possible?

© Stack Overflow or respective owner

Related posts about regexp