JSFiddle - React, Tailwind, and code Playground

JavaScript

var str="<p>fhgfhgfhgfh</p><br><br><br><p>ghgfhfgh</p><br><br><br><p>";

var n = str.replace(/(<br>)+/g, '<br>');

console.log(n);