私はこのjqueryプラグインを使用しています:https ://github.com/maranomynet/linkify/blob/master/1.0/jquery.linkify-1.0.js
このREGEXプラグインを使用して、@usernamesと#hashtagsをリンクしようとしています...
linkify.plugins = {
tUser: {
re: /(^|\s)@(\w+)/gi,
tmpl: '$1@<a href="http://domain.com/$2">$2</a>'
},
tHashtag: {
re: /(^|["'(]|<|\s)(#.+?)((?:[:?]|\.+)?(?:\s|$)|>|[)"',])/gi,
tmpl: function (match, pre, hashTag, post) {
return pre+'<a href="http://domain.com/search.php?q='+ encodeURIComponent(hashTag) +'">'+hashTag+'</a>'+post;
}
}
};
...しかし、私は奇妙な組み合わせでいくつかの問題を抱えています:
(太字では、リンクする必要があるがリンクしないもの)
@ user @ user)(@ user)/ @ user
このバリエーションに一致するように正規表現を修正するにはどうすればよいですか?
ありがとう!