JSFiddle - React, Tailwind, and code Playground JavaScript var str = "ff ff f f a de def"; str = str.replace(/f/g,''); alert(str);