javascript - Split string after 3 times repeated <br> -


i have small problem, have tried solve 3 hours now.

i have text this:

<div> hello name andreas <br> nice meet <br><br> regards andreas <br> <br> <br>  <br> <br> <br> <br> <br> <br>        </div> 

i remove <br>, after have occured 4 times in row <br><br><br><br>.

i have tried split , replace, can't twist work desired way. hope can help:-)

you :

str = str.replace(/(<br>\s*){4,}/g,'<br><br><br>')          .replace(/meat/g, 'meet'); 

demonstration


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -