JSFiddle - React, Tailwind, and code Playground
JavaScript
error_text = 'this is < cool " beans >';
alert('before\n' + error_text);
// Replace all < and > by < and >
error_text = error_text.replace(/&(lt|gt|quot);/g, function (m, p) {
console.log(p);
return (p == "lt") ? "<" : ((p == "gt") ? ">" : "'");
});
alert('after\n' + error_text);