title: Replace HTML closing tags with HTML tags + \n Analysis
body: <p>I need to replace HTML closing tags with HTML tags + \n. I've found this <a href="https://stackoverflow.com/questions/29396013/replacing-closing-html-tags-with-html-tag-n">SO answer</a></p>
  
  <pre><code>var regex = new RegExp("(&lt;/.*?&gt;)", "gi");
  
  strContent = strContent.replace(regex, "$1 \n   ")
                     .replace(/\/&gt;/g,'/&gt; \n    ');
  </code></pre>
  
  <p>Could someone explain to me what is happening in the above code? Why is a regex declared then replaced? What does each part mean?</p>