title: Perl MongoDB API - regular expression in filters
body: <p>I am working in Perl with a MongoDB. I have a collection with documents that have a big text field that I need to be able to find all rows that contain multiple strings in the field.</p>
  
  <p>So for instance, if this is a database of movie quotes one row would have value:</p>
  
  <blockquote>
    <p>We must totally destroy all spice production on Arrakis. The Guild and
    the entire Universe depends on spice. He who can destroy a thing,
    controls a thing.</p>
  </blockquote>
  
  <p>I want to be able to match that row with terms "spice", "Arrakis", and "Guild" where ALL of those terms have to be in the text.</p>
  
  <p>My current approach can only achieve matches if the terms provided happen to be in the correct order, i.e.:</p>
  
  <pre><code>$db-&gt;get_collection( 'quotes' )-&gt;find( { quote =&gt; qr/spice.*Arrakis.*Guild/i } );
  </code></pre>
  
  <p>That's a match, but</p>
  
  <pre><code>$db-&gt;get_collection( 'quotes' )-&gt;find( { quote =&gt; qr/Guild.*spice.*Arrakis/i } );
  </code></pre>
  
  <p>is not a match.</p>
  
  <p>If I were working with a SQL database I could do:</p>
  
  <pre><code>... WHERE quote LIKE '%spice%' and quote LIKE '%Arrakis%' and quote LIKE '%Guild%'
  </code></pre>
  
  <p>but with the MongoDB interface you only get one shot per field.</p>
  
  <p>Is there a way to match multiple words where all are required in one regex, or is there another way to get more than one crack at a field in the MongoDB interface?</p>