Using Regex might be one of the worst ways to do this. A better way is to modify a DOM tree instead.
varelem=document.createElement("div");elem.innerHTML="ur text here";Array.from(elem.children).forEach(child=>{if(!(child.tagName==="a"))return;child.replaceWith(document.createTextNode(child.textContent));})
Using Regex might be one of the worst ways to do this. A better way is to modify a DOM tree instead.
Thank you @shadowtime2000 , your way is definitely better 💪🏻 I updated the post adding your solution. Thanks!