Функция
$.fn.tweetify = function() ( this.each(function() ( $(this).html( $(this).html() .replace(/((ftp|http|https):\/\/(\w+:(0,1)\w*@)?(\S+)(:(0-9)+)?(\/|\/((\w#!:.?+=&%@!\-\/)))?)/gi,'$1') .replace(/(^|\s)#(\w+)/g,'$1#$2') .replace(/(^|\s)@(\w+)/g,'$1@$2') ); )); return $(this); )
использование
$("p").tweetify();
Перед
@seanhood have you seen this http://icanhascheezburger.com/ #lol
После
@seanhood have you seen this http://icanhascheezburger.com/ #lol