JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

JavaScript

var texto = 'xxxxxxxxboloxxxxxxxfarinhaxxxxxxacucarxxxx';

var expReg = /([x]+)/g;
var busca = texto.replace(expReg, '');

if(busca == "bolofarinhaacucar"){
    console.log("Sucesso");
}