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 buscaArray = texto.match(expReg, '').toString(); // match retorna um array com os valores encontrados
var busca = buscaArray.split(",").join("");

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