JSFiddle - React, Tailwind, and code Playground
HTML
the man walked to the shops.
CSS
.cross {
font-style:italic
}
JavaScript
var text = 'the';
$('*').html( function ( i, html ) {
var regexp, replacement;
regexp = RegExp( '(' + text + ')', 'gi' );
replacement = '<span class="cross">$1</span>';
return html.replace( regexp, replacement );
});