I want to replace the multiple <br> tags with single <br> in a text.
my text like,
<p>fhgfhgfhgfh</p>
<br><br>
<p>ghgfhfgh</p>
<br><br>
<p>fghfghfgh</p>
<br><br>
<p>fghfghfgh</p>
<br><br>
<p>fghfgh</p>
<br><br>
How i replace the multiple <br> with single <br>?.
Try this
Working DEMO
Edit: Above works for 2
brtags, code below should take care of any number of br tags.Working DEMO
where
/.../denotes a regular expression,(<br>)denotes<br>tag, and+denotes one or more occurrence of the previous expression and finallygis for global replacement.