let string = "your_text"; string = string.replace(regExp, (url) => "<a href='" + url + "'>" + url + "</a>");
try the above solution. It will replace all the URLs in your string with an anchor tag