Parse URL String - Node.js String

Node.js examples for String:URL String

Description

Parse URL String

Demo Code

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>');
};

Related Tutorials