Trying to replace two <br />
with a single one.
Can't get it work. been trying for a couple of hours.
My code: thishtml = thishtml.replace(/(?:<br \/\>\s*){2,}/g, '<br>')
Not working.
Help will be great.
Thanks ahead.
Trying to replace two <br />
with a single one.
Can't get it work. been trying for a couple of hours.
My code: thishtml = thishtml.replace(/(?:<br \/\>\s*){2,}/g, '<br>')
Not working.
Help will be great.
Thanks ahead.
$('br').map(function(){
($next = $(this).next()).is('br') && $next.remove();
});
If your html is not coming from the DOM:
$(thishtml).find('br').map( ... )
try this :
.replace(/(?:<\s*br\s*\/?\>\s*){2,}/ig, '<br/>');
example :
var a='sdf sd\
sdf\
sdf\
<br />\
<br/>\
dfbd'
result :
sdf sdsdfsdf<br/>dfbd
's with only one
](http://stackoverflow.com/questions/17061931/replace-multiple-brs-with-only-one-br) – Qantas 94 Heavy Nov 14 '13 at 13:47