JSFiddle - React, Tailwind, and code Playground

HTML

<div>bye demo-hello water</div>

JavaScript

$(function(){
    $('div').each(function(){
      var text = $(this).text().replace(/\b\s?demo-[^\s]+\b/g, '');
        $(this).text(text);
    });
});