Replace anchor tags with spans, and place the href attribute into the span
One thing to consider is the whole working with HTML as string. In the answer I'll assume you work within the web-browser. The web-browser can parse the HTML for you, this way you'll only have to work with nodes.

Here is an example:



const testHtml = `
  &lt;p&gt;This is a test paragraph&lt;/p&gt;
  &lt;a style="font-weight: bold;" href="http://www.google.co.uk"&gt;Google is here&lt;/a&gt;
  &lt;a style="font-weight: bold;" href="http://www.msn.co.uk"&gt;Msn is here&lt;/a&gt;
  &lt;h2&gt;This is a heading&lt;/h2&gt;
`;

function transformLinksToTextOnly(htmlString) {
  const root     = document.createElement('root');
  root.innerHTML = htmlString;
  const anchors  = root.querySelectorAll('a');

  anchors.forEach(anchor =&gt; {
    const span = document.createElement('span');

    span.innerHTML = anchor.innerHTML;
    if (anchor.href) 
      span.innerHTML += ` (${anchor.href})`;

    anchor
      .getAttributeNames()
      .forEach(attrName =&gt; {
        const attrValue = anchor.getAttribute(attrName);
        span.setAttribute(attrName, attrValue);
      });

    anchor.parentNode.replaceChild(span, anchor);
  });

  return root.innerHTML;
}

const result = transformLinksToTextOnly(testHtml);

document.body.innerHTML += testHtml;
document.body.innerHTML += '&lt;hr /&gt;';
document.body.innerHTML += result;