title: Regular expression which matches at least two words from a list
body: <p>I have a list of words - <code>"foo"</code>, <code>"bar"</code>, <code>"baz"</code> - and I want to write a regexp which would match strings which contain at least 2 of them. E.g., <code>"foo baz"</code> should match while <code>"ba foo z"</code> should not.</p>
  
  <p>The obvious solution <code>"(foo|bar|baz).*(foo|bar|baz)"</code> works, but I find it unsatisfactory because it lists the words <em>twice</em>. What if I have 25 words instead of just 3? What if I am looking for strings which contain at least 4 given words instead of just 2? </p>