ページ内の URL を自動リンクする必要があります。
例えば
これは HTML コンテンツで、テキスト URL www.example.com とリンクされた URL <a href='www.example.com'> example </a> が含まれています。[http://www.example.com] のように http が続く場合があります。
結果が次のようになる必要があります。
これは HTML コンテンツであり、テキスト URL http://www.example.comとリンク URL http://www.example.comが含まれています。http://www.example.comのように http が続く場合があります。
以下の関数を使用しましたが、www で始まる URL では機能しません。
jQuery.fn.autolink = function() { return this.each(function() { // http://、https://、または ftp:// で始まる URL var re = /((http|https|ftp):\/\/[\w?=&.\/-;#~%-\{\}$!|]+(?![\w\s? &.\/;#~%"=-]*>))/g; $J(this).html($J(this).html().replace(re, '$1')); }); }