JSFiddle - React, Tailwind, and code Playground

HTML

<span> 
An apple a day, makes 7 apples a week!
</span>

JavaScript

var span = $('p');
    span.html(replaceURLWithHTMLLinks(span.html()));


function replaceURLWithHTMLLinks(text) {
  var exp = /(apple)/ig;
    return text.replace(exp,"<a class='link' href='http://www.$1.com' target='_blank' >$1</a>"); 
}