Javascript String parselinks()

Description

Javascript String parselinks()


String.prototype.parselinks = function() {
    var regexp = /((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi;
    return this.replace(regexp,'<a href="$1" target="_blank">$1</a>');
};



PreviousNext

Related