var str = '<BR><BR>http://wasmip.baidu.com.cn/mip/km/archives/km_archives_main/kmArchivesMain.do?method=view&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);