I was wondering how could I do to separate what triggered the RegExp. What I want to do is get the URL part so I can check if that URL is valid. I've tried several things, but none of them gave a good result. Thank you in advance.
Examples: Valid URL: google.com, invalid url: u9fwhuwh9gi8h9hgwgwvns.com
var re = new RegExp("([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?(/.*)?");
if(re.test(message.content)) {
urlExists(<Insert Valid URL Here>, function(err, exists) {
if (exists == true) {
console.log("Valid URL found");
}
});
}