JSFiddle - React, Tailwind, and code Playground
JavaScript
var text = '<p></p><p></p><p>fsadfsafsa<p></p><p>adfsafa</p><p>fdsafsafa</p><p></p>';
console.log(formatContent(text));
function formatContent(text) {
if (text.length) {
return text.replace('/(<p><\/p>)+/g', '');
}
return '';
}