JSFiddle - React, Tailwind, and code Playground JavaScript var regEx = /<|>/g; var testString = "<test>" alert(testString.replace(regEx,"*"))