📜  js用锚标签替换文本链接 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:07.355000             🧑  作者: Mango

代码示例1
var exp_match = /(\b(https?|):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
   var element_content=content.replace(exp_match, "$1");
   var new_exp_match =/(^|[^\/])(www\.[\S]+(\b|$))/gim;
   var new_content=element_content.replace(new_exp_match, '$1$2');