title: Regex with Doctrine 2 query builder?
body: <p>As per the title, how would one match on a regular expression with the Doctrine 2 query builder? Basically I'm trying to generate unique slugs. </p>
  
  <p>Here is my current implementation. I generate the slug. I then check to see if there are any slugs in use like this slug. If there are, I will append a -{number} to the end of the slug where {number} is the lowest number not already in use.</p>
  
  <pre><code>$qb-&gt;select(array('partial o.{id, slug}'))
     -&gt;from('Foo\Bar\Entity\Object', 'o')
     -&gt;where($qb-&gt;expr()-&gt;like('o.slug', ':slug'));
  
  $slug = new SlugNormalizer($text);
  $qb-&gt;setParameter('slug', $slug-&gt;__toString().'-%');
  </code></pre>
  
  <p>The problem here is LIKE slug% could match foo-bar-1, foo-bar-2, AND foo-bar-not-the-same-slug. What would be cleaner is a regex looking for REGEX slug-(\d+) or something similar.</p>
  
  <p>Any way to do this with the Doctrine 2 query builder?</p>