JSFiddle - React, Tailwind, and code Playground

JavaScript

function strip(str, substitutes) {
    return substitutes.reduce((acc, substitute) => acc.replace(new RegExp(substitute.search, 'g'), substitute.replace), str);
}

const stripped = strip("The brown fox jumped #1 times", [
   {
      search: '#',
      replace: ' '
   },
   {
      search: ' ',
      replace: '_'
   }
]);

console.log(stripped);