Javascript String linkify(extra)

Description

Javascript String linkify(extra)


String.prototype.linkify = function(extra){
    var text = this;
    var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
    return text.replace(exp,"<a href='$1' "+extra+">$1</a>"); 
}



PreviousNext

Related