I have a Backbone App where I fetch Twitter tweets through an API which returns the result as string. What I need is to make the http in the string clickable. How can I achieve this?
Here is the text string:
 Who does John wish he could have sung with over the span of his career? See the video answer here! http://t.co/pbPXaDkGEJ 
and I want it to be like
<span>Who does John wish he could have sung with over the span of his career? See the video answer here! <a href="http://t.co/pbPXaDkGEJ"> click here</a></span>
I tried to do something like:
function replaceURLWithHTMLLinks(text) {
   var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
   return text.replace(exp,"<a href='$1'>$1</a>"); 
}
but that didnt work...
[UPDATE]
Ok, I'm gonna add my Backbone View:
function (App, Backbone) {
    var ArtistTwitter = App.module();
    ArtistTwitter.View = Backbone.View.extend({
        tagName: 'ul',
        className: 'actweets',
        template: 'artistTwitter',
        initialize: function() {
            this.listenTo(this.collection, 'all', this.render);
        },
        serialize: function() {
            return this.collection ? this.collection.toJSON() : [];
        }
    });
    ArtistTwitter.ArtistTwitterCollection = Backbone.Collection.extend({
        url: function() {
            return '/myproject/index.php/api/social_feeds/fetchNewTweet/' + this.artist_id;
        }
    });
    return ArtistTwitter;
}
I tried to add the above mentioned replacement code inside an afterRender-function but that didnt work...
Any suggestion is welcome...
 
    