title: Postgresql and ActiveRecord where: Regex matching
body: <p>I created this regex in normal Regex</p>
  
  <pre><code>/(first|last)\s(last|first)/i
  </code></pre>
  
  <p>It matches the first three of </p>
  
  <pre><code>first last
  Last first
  First Last
  First name
  </code></pre>
  
  <p>I am trying to get all the records where the <code>full_name</code> matches with the regex I wrote. I'm using PostgreSQL</p>
  
  <pre><code>Person.where("full_name ILIKE ?", "%(first|last)%(last|first)%")
  </code></pre>
  
  <p>This is my attempt. I also tried <code>SIMILAR TO</code> and <code>~</code> with no luck</p>