I have a HTML string like this:
<div>My cat</div><div>My dog</div><div>12345</div>
I want to use Regex to replace globally string (change </div><div> into <br/>, then remove all HTML, just keep <br/> only:
My cat<br/>My dog<br/>12345
I tried with this code:
var formatHTMLQuill = function (stringHTML) {
let t = stringHTML.replace('</div><div>', '<br/>');
let n = t.replace(/<(?!br\s*\/?)[^>]+>/g, '')
return n
}
But it's not work, result is My cat<br/>My dog</div><div>12345
let t = stringHTML.replace('</div><div>', '<br/>');gflag to force.replaceto do it multiple times.