JSFiddle - React, Tailwind, and code Playground

HTML

<div>Some reallllly

realllyyy long text</div>

JavaScript

$.expr[":"].contains = $.expr.createPseudo(function(arg) {
    return function( elem ) {
        return $(elem).text().replace(/(\n)+/g, " ").indexOf(arg) >= 0;
    };
});

$(document).ready(function(){
    $('div:contains("Some reallllly realllyyy long text")').css('color', 'red');
});