CODE:
var searchedTerm = "test";
var returnedString = "National testing Plant testers";
var replacedString = returnedString.replace(/\searchedTerm/g, '<span class="highlight">'+searchedTerm+'</span>');
In other words I'm after replacing a searched string, from a returned longer string, to highlight wherever the searched string matched the returned one. Keeping in mind to highlight if it matches more than once in the same returned string aka global.