kapil singh kapil singh - 5 months ago 32
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>')