title: Find all the links and replace them with their href value
body: <p>I think I have a string like:</p>
  
  <pre><code>&lt;a href="site/project/109#" target="_blank"&gt;href&lt;/a&gt; text, text, &lt;a href="/target" class="test"&gt;test&lt;/a&gt;
  </code></pre>
  
  <p>And I need to output</p>
  
  <pre class="lang-none prettyprint-override"><code> site/project/109# text, text, test
  </code></pre>
  
  <hr>
  
  <p>I can find all links </p>
  
  <pre><code>var txt = msg.match(/\&lt;a\shref=\"(.*)\"\s(.*)[\&lt;\/a\&gt;]/gmi);
  </code></pre>
  
  <p>And in loop make replace. But I would like to shorten the code, do everything through single <strong>replace</strong>, like this :</p>
  
  <pre><code>var txt = msg.replace(/\&lt;a\shref=\"(.*)\"\s(.*)[\&lt;\/a\&gt;]/gmi, $1); 
  </code></pre>
  
  <p>But in this case I get: <strong>[object HTMLHeadElement]</strong></p>