JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test">my favorite search engines are http://www.google.com and http://stackoverflow.com Do you agree?</div>

JavaScript

var urlRE = /(^|[^'">])((ftp|http|https):\/\/(\S+))(\b|$)/gi;
var $test = $('#test');
var text = $test.text();

text = text.replace(urlRE, "<a href=\"$&\">$&</a>");

$test.html(text);