JSFiddle - React, Tailwind, and code Playground JavaScript var tmp = "8969" alert("8969_8969".replace(new RegExp(tmp,"g"), "99"));