this might be easy but I just can´t see the forest because of trees. Given is following function:
const urlify = text => {   
    let urlRegex = /(https?:\/\/[^\s]+)(<\/td>)/g;      
    return text.replace(urlRegex, function(text) {
            return '<a href="' + text + '">' + text + '</a>';
        })
     }
      
    alert(urlify('<td>http://test.com</td>'))more or less like the function from this SO answer.
The regex replace() function currently gets the whole match. Hence the link contains the closing </td>. How would I just access the first capture group urlRegex.exec(text)[1] inside the function?
 
     
    