JSFiddle - React, Tailwind, and code Playground

HTML

<p>My dog is young</p>
<p>I have a _dog_</p>
<p>Dogs are fine</p>

CSS

.color{color:green;}

JavaScript

$("p").each(function () {
    var href = $(this).text();
    if(href.match(/ dog /g)){
        $(this).addClass("color");
    }
});