json twitter 応答からの URL と応答を解析する 2 つの正規表現関数が既にありましたが、それを拡張してハッシュタグも解析しようとしましたがundefined
、ハッシュタグの場所に表示されています。
// process links, reply and hash tags
tweet = tweet.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
return '<a href="'+url+'">'+url+'</a>';
}).replace(/B@([_a-z0-9]+)/ig, function(reply) {
return reply.charAt(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>';
}).replace(/#([a-zA-Z0-9]+)/g), function(hash) {
return '<a class="hashtag" target="_blank" href="http://twitter.com/#search?q='+$1+'">#'+$1+'</a>';
};
どこが間違っているかについての指針はありますか?