title: How to remove unnecessary tags from html generate from text editor
body: <p>Below is a html script auto generated from word document by text editor, <a href="https://summernote.org/" rel="nofollow noreferrer">summernote</a>.</p>
  
  <pre><code>var html = `
  &lt;p&gt;
     &lt;b&gt;
     &lt;br&gt;
     &lt;/b&gt;
  &lt;/p&gt;
  &lt;p&gt;
     &lt;b&gt;អ្នកធានា&lt;/b&gt;
  &lt;/p&gt;
  &lt;p&gt;
     &lt;b&gt;ឈ្មោះ: ……………………………&lt;/b&gt;
  &lt;/p&gt;
  &lt;p&gt;
     &lt;b&gt;អត្តសញ្ញាណប័ណ្ណលេខៈ………………...............
     &lt;span style="white-space:pre"&gt;&lt;/span&gt;..........................................
     &lt;/b&gt;
  &lt;/p&gt;
  &lt;p&gt;
     &lt;b&gt;
     &lt;span style="white-space:pre"&gt;&lt;/span&gt;ហត្ថលេខានិង ស្នាមមេដៃស្តាំ
     &lt;span style="white-space:pre"&gt;&lt;/span&gt;
     &lt;/b&gt;
  &lt;/p&gt;
  &lt;p&gt;
     &lt;b&gt;
     &lt;br&gt;
     &lt;/b&gt;
  &lt;/p&gt;
  &lt;p&gt;`;
  </code></pre>
  
  <p>After it generate hmlt code for me, I tried to clean it up by removing an unnecessary, empty tags, and tags that does not contain any value.</p>
  
  <p>So, I tried my JS script as below:</p>
  
  <pre><code>html.replace('&lt;p&gt;&lt;br&gt;&lt;/p&gt;', ''); // remove unneccessary tage
  html.replace('&amp;nbsp;', ''); // remove &amp;nbsp; space
  console.log(html);
  </code></pre>
  
  <p>However, after JS script above nothing change, the empty and unnecessary tags still exist.</p>
  
  <p>I don't why it does not work,but I tried just very simple replace <code>'&lt;p&gt;&lt;br&gt;&lt;/p&gt;not replaced'.replace('&lt;p&gt;&lt;br&gt;&lt;/p&gt;','')</code>, it work just fine.</p>
  
  <p>What's wrong with above? How can I remove all unnecessary tags from above? Thanks.</p>