JSFiddle - React, Tailwind, and code Playground
HTML
<pre id="o"></pre>
CSS
body {
font-family: Consolas, monospace;
font-size: 14pt;
padding: 20px;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
}
JavaScript
let str = "may mays;
str = str.toLowerCase();
str = str.replace(/ /g, " ");
str = str.replace(/[a-z0-9]/g, ":m$&:");
document.getElementById("o").innerHTML = str;