JSFiddle - React, Tailwind, and code Playground
HTML
<p>This is some copy. In this copy is the word hello</p>
<p>This is some copy. In this copy is the word <a href="">hello</a></p>
JavaScript
$('p').each(function(){
if($(this).find('a').length > 0) return;
lastSpaceIndex = $(this).text().lastIndexOf(' ');
if(lastSpaceIndex == -1)
lastSpaceIndex = 0;
WordToReplace = $(this).text().substring(lastSpaceIndex);
idx = $(this).text().lastIndexOf(WordToReplace);
resultstring = $(this).text().substring(0, idx);
$(this).html(resultstring);
$(this).append($( "<a href='#'>" + WordToReplace + "</a>"));
});