var str = '<BR><BR>http://wasmip.baidu.com.cn/mip/km/archives/km_archives_main/kmArchivesMain.do?method=view&amp;fdId%1059192<BR>测试22222<BR>http://www.baidu.com<BR><BR>www.baidu.com';  

        var re=/(http:\/\/)?([A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*)/g;  

        str=str.replace(re,function(a,b,c){return '<a href="http://'+c+'">'+a+'</a>';});     

        alert(str);  





--------------------- 本文来自 zhang__ao 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/zhang__ao/article/details/79787236?utm_source=copy

Created with the Personal Edition of HelpNDoc: Free HTML Help documentation generator