Forum Moderators: coopster
I've been struggling with trying to find a way to remove every occurence in my page when there are 2 or more <br />'s, but not when there is only one
Basically, what I want is to allow all single <br />'s through, but when there are 2 or more <br />'s next to each other, to remove it
I tried using this code
$page = preg_replace('/(<br \/>){2,}/is','',$page);
Which works when there are 2 <br />'s right NEXT to each other, but if the second <br /> is on another line, it doesnt work. I thought the /s was supposed to fix this (take it in as a single line)?
Is there any way I can make it work for when the code goes like this:
<br />
<br />
as well as
<br /><br />
I'd apreciate any help
Thanks
j4mes: Are you sure? I've been using it with a / in that direction rather than a \ for all the other regexp and it works. Also, the i tag tag works with it that way?
bennymack, I tried that, but I still get nothing, same as when using /s
The code I tried was
$page = preg_replace('/(<br \/>){2,}/im','test',$page);