JSFiddle - React, Tailwind, and code Playground
HTML
<textarea rows="10" cols="45" id="text">Аноны, скоро на украине будут убивать и сажать в тюрьму.</textarea><br/>
<button onclick="maketext();">Укрiїнiфiцiрiвiть</button>
JavaScript
maketext = function()
{
text = $("#text").val();
text = text.replace(/([уыаояиюУЫАОЯИЮ])/g, replacei);
text = text.replace(/(ii)/g, 'i');
text = text.replace(/(и)/g, 'i');
text = text.replace(/(И)/g, 'I');
text = text.replace(/(II)/g, 'I');
text = text.replace(/(е)/g, 'є');
text = text.replace(/(Е)/g, 'Є');
text = text.replace(/(э)/g, 'е');
text = text.replace(/(Э)/g, 'Е');
text = text.replace(/(\sна\s)/g, 'в');
text = text.replace(/(\sНа\s)/g, 'В');
text = text.replace(/(ь)/g, '\'');
$("#text").val(text);
}
replacei = function(str, p1, offset, s)
{
i = 'i';
if(p1.search(/[УЕЫАОЯИЮ]/) != -1) i = 'I';
if((s[offset+1] == ".") || (s[offset-1] == " ") || (s[offset+1] == " ") || (offset == 0) || (offset == s.length-1)) i = p1;
return i;
}