JSFiddle - React, Tailwind, and code Playground
HTML
<p class="greeting">
Hello, my name is Kevin. what's yours?
<br>
My name is Kevin, too.
</p>
CSS
.highlight { background-color: yellow; }
JavaScript
var text = 'My namE iS';
$( 'p.greeting' ).html( function ( i, html ) {
var regexp, replacement;
regexp = RegExp( '(' + text + ')', 'gi' );
replacement = '<span class="highlight">$1</span>';
return html.replace( regexp, replacement );
});