JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "there is a cookie in this sentence";
var replaced = str.replace(/this|is/g, '');
var parts = str.split(/\s/);

$('body').append('<p>' + parts + '</p>');