title: Javascript: using String.replace() to replace/remove HTML anchors
body: <p>I am trying to accomplish a task that would be very simple if there was a way to replace one simple string with another.</p>
  
  <p>I have an HTML source of a page as a string. It contains several internal anchors such as
  &lt;a href="#about"&gt;, &lt;a href="#contact"&gt;, &lt;a href="#top"&gt;, &lt;a href="#bottom"&gt;, &lt;a href="#who-we-are"&gt;, etc.</p>
  
  <p>All of the anchors are stored in an array (['about','contact'],...), and I need to remove every occurance of a string like</p>
  
  <pre>href="#whatever"</pre>
  
  <p>(where whatever is each time something different) so that the result is
      &lt;a&gt;</p>
  
  <p>What I'd do with simple search and replace would be to iterate through my array and replace each occurance of</p>
  
  <pre>'href="'+anchorname+'"'</pre>
  
  <p>with an empty string. But after many attempts with string.replace() I still have't found the way to accomplish this.</p>
  
  <hr>
  
  <p>In other words (posted also in the comments):
  A much simpler way to put my question would be this:</p>
  
  <p>Suppose my string contains the following three strings</p>
  
  <p>&lt;a href="#contact"&gt; &lt;a href="#what"&gt; &lt;a href="#more"&gt;</p>
  
  <p>How to I use Javascript to replace them (but NOT any tag with the same pattern) with &lt;a&gt; ?</p>