jQuery.fn.highlight = function (text, o) { return this.each( function(){ var replace = o || '$1'; jQuery(this).html( jQuery(this).html().replace( new RegExp('('+text+'(?![\\w\\s?&.\\/;#~%"=-]*>))', "ig"), replace) ); }); } jQuery.fn.autolink = function () { return this.each( function(){ var re = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-]+(?![\w\s?&.\/;#~%"=-]*>))/g; jQuery(this).html( jQuery(this).html().replace(re, '$1 ') ); }); } jQuery.fn.mailto = function () { return this.each( function() { var re = /(([a-z0-9*._+]){1,}\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}([a-z]{2,4}|museum)(?![\w\s?&.\/;#~%"=-]*>))/g jQuery(this).html( jQuery(this).html().replace( re, '$1' ) ); }); }