JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="test">Hello Cruel <br />World!</textarea>
JavaScript
function replaceHtml( string_to_replace )
{
return string_to_replace.replace(/ /g, ' ').replace(/<br.*?>/g, '\n');
}
var str = $("#test").val();
$("#test").val(replaceHtml(str));