JSFiddle - React, Tailwind, and code Playground

HTML

<body>
<p>
ABC DEF<p>GHI</p>
JKL<br>MNO
</p>
</body>

JavaScript

var text = $('body').html();
var str = text.replace( /<br\s*[\/]?>/gi, '\r\n');
var str2 = str.replace(/<\/?p[^>]*>/g, '\r\n')
var str3 = str2.replace(/  +/g, ' ');
console.log(str3)