JSFiddle - React, Tailwind, and code Playground
by 2Yootz
JavaScript
var linkRegex =/(?:((?:(?:[a-zA-Z]+\:\/\/)|(?:[wW]{3}\.)|(?:file\:)|(?:\\\\))(?:[/\:\w\.\,\;\?\'\\\+&%\$#\!\=~_\-])+[\w\\\/]))|(\b[_a-zA-Z0-9-]+(?:\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*(?:\.[a-zA-Z]{2,4}))/gi;
var text = 'before http://localhost:50000/apps/order-info after';
while ((match = linkRegex.exec(text))) {
matchedUri = match[1] || match[2];
console.log(match[1]);
console.log(match[2]);
break;
}