JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = '#this #is__ __#a test###__'
str = str.replace(/#|_/g,'')
alert(str)