var msg=document.getElementsByName("sboyz"); for(var i=0;i <msg.length;i++){var txt=document.getElementsByName("sboyz")[i].innerHTML; txt=txt.replace(/\n/ig,''); txt=txt.replace(/\<a href="(.+?)">@(.+?)@(.+?)<\/a>/ig,'<a href="$1">$3</a>');document.getElementsByName("sboyz")[i].innerHTML=txt; }; 