const html = ` h=h.replace(/([=!<>+\\\\-*/%|&^~?:]+)/g,'$1');`; console.log(html); try { eval(html); console.log("OK"); } catch(e) { console.log("ERROR:", e.message); }