JSFiddle - React, Tailwind, and code Playground

JavaScript

var str = "This is an example sentence, thanks.";
alert("ThisXis aX exaXple XenteXce, XhankX.\n"+str.replace(/(....)./g, "$1X"));