title: Is there a database that can store regex as values?
body: <p>I am looking for a database that can store regex expressions as values. E.g. somthing like this:</p>
  
  <pre><code>{:name =&gt; "Tim", :count =&gt; 3, :expression =&gt; /t+/},
  {:name =&gt; "Rob", :count =&gt; 4, :expression =&gt; /a\d+/},
  {:name =&gt; "Fil", :count =&gt; 1, :expression =&gt; /tt/},
  {:name =&gt; "Marc", :count =&gt; 1, :expression =&gt; /bb/}
  </code></pre>
  
  <p>So I could return rows/documents based on whether the query matches the expression or not (e.g."FIND rows WHERE "tt" =~ :expression"). And get Tim and Fil rows as the result. Most databases can do the exactly opposite thing (check whether a text field matches a regex query). But neither mongo nor postgres can do the opposite thing, unfortunately.</p>
  
  <p>P.S. Or perhaps I am wrong and there are some extensions for postgres or mongo that allow me to store regex?</p>