function addATagToHttpUrl ( text ) { return text . replace ( / \b http\S + / g , function ( x ) { return "<a target='_blank' href='" + x + "'>" + x + "</a>" ; }); }
// remove html tags function removeTags ( text ) { var div = $ ( '<div/>' ); div . html ( text ); div . contents (). filter ( function () { return this . nodeType !== 3 ; }). after ( function () { return $ ( this ). text (); }). remove (); return div . text (); }