JSFiddle - React, Tailwind, and code Playground
by Town
HTML
<div>here's a link to www.facebook.com: http://www.facebook.com/usernameone</div>
<div>here's another link to just facebook.com: http://facebook.com/username.two</div>
<div>here's another link to just www.facebook.com without the http://: www.facebook.com/username.three</div>
JavaScript
$(function() {
var re = new RegExp("(?:http:\/\/)?((?:www\.)?facebook.com/)([^<]*)","gi");
$("body").html($("body").html().replace(re, "<a href='http://$1$2' target='_blank'> $2 </a>"));
});