title: PostgreSQL: Check if substring is in a string and if true then replace the entire string with the substring
body: <p>I have a column in a table like this:</p>
  
  <hr>
  
  <pre><code>|  biz_name   |
  ---------------
  | www.Dog.com | 
  | Dog LLC.    |
  | Dog Inc.    |
  | www.Cat.com |
  | Cat Corp    |
  </code></pre>
  
  <p>And for each element in the column, I want to check if it contains the substring 'Dog' or 'Cat' and if it does, then to replace the entire string with either 'Dog' or 'Cat'.</p>
  
  <p>The results should be:</p>
  
  <hr>
  
  <pre><code>| biz_name |
  ---------------
  | Dog | 
  | Dog |
  | Dog |
  | Cat |
  | Cat |
  </code></pre>
  
  <p>Is there a way to do this without using CASE WHEN as such:</p>
  
  <pre><code>    CASE 
      WHEN biz_name ilike '%Dog%' THEN 'Dog'
      WHEN biz_name ilike '%Cat%' THEN 'Cat'
      ELSE biz_name END as biz_name    
  </code></pre>
  
  <p>The above table is just an example to demonstrate what I'm trying to do, but the actual table I'm working on has many more substrings I'm trying to search for and replace with that using multiple CASE WHEN statements can get tedious. Does anyone have a more efficient way to do it? Thanks.</p>