My attempt to replace a specific content in the HTML body is illustrated in the code snippet below.
var fontReplacer = $("body").html().replace(/\{fontsize:(.*?)\}(.*?(({fontsize\})|$)/g,'<span style="font-size:$1px">$2</span>');
$("body").html(fontReplacer);
However, after running this code, other functions on the page are no longer working. Did I write the code correctly to replace content like
{fontsize:12}12px text here{font}
with 12px text here (in 12px size)?
Could someone please assist me in identifying where I made an error?