function link() { const content = document.querySelector('#jsContainer') const html = content.innerHTML const newHtml = html.replace(/((http|https):\/\/)?www\.\w*\.com(\.cn)?(\?\w*=\w*)?(&(\w*=\w*))*/g, function(res) { if(res.startsWith('www')) { const url = res.replace('www', 'http://www') return `<a href="${url}" target="_blank">${res}</a>` } else { return `<a href="${res}" target="_blank">${res}</a>` } }) content.innerHTML = newHtml }