I want to replace all unnecessary breaks in a string. I have written a Regex replace but it throws an error: SyntaxError: unterminated parenthetical
var str = "<H1>sdflk</H1><BR><BR><BR><BR><P>test</P><BR><BR><BR><BR>";
str.replace(/((</[a-zA-Z0-9]+>)(<BR>)+)/,"\$2");
But I don't see the missing parenthese.