JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div>
hoge
moge
hage
unk
</div>
</body>
JavaScript
$('div:contains("hoge")').each(function(){
var txt = $(this).text();
$(this).html(
txt.replace(/hoge/g,'<span style="color:red">hoge</span>')
);
});