title: PostgreSQL replace HTML entities function
body: <p>I've found <a href="http://www.siafoo.net/snippet/148" rel="noreferrer">this very interesting function on internet</a>:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION strip_tags(TEXT) RETURNS TEXT AS $$
      SELECT regexp_replace(regexp_replace($1, E'(?x)&lt;[^&gt;]*?(\s alt \s* = \s* ([\'"]) ([^&gt;]*?) \2) [^&gt;]*? &gt;', E'\3'), E'(?x)(&lt; [^&gt;]*? &gt;)', '', 'g')
  $$ LANGUAGE SQL;
  </code></pre>
  
  <p>But it doesn't remove html codes like: <code>&amp;quot;</code> <code>&amp;nbsp;</code>
  Is it possible to remove them using regexp_replace?</p>