kapil singh kapil singh - 2 months ago 6
HTML Question

Remove extra br tags after specific count

I have a string and would like to display only 2

br
tags and after that remove all
br
tags.

text.replace(/<br><br><br>/g, '<br><br>')

Answer
text.replace(/(<br>)+/g, '<br><br>')