JSFiddle - React, Tailwind, and code Playground

HTML

<p>The rain in Spain stays mainly on the plain</p>

CSS

.red {
    color: #f00;
}

JavaScript

$('p').html($('p').text().replace(/(ain)/gi, '<span class="red">$1</span>'));