I want to replace the <br> tags with a space in a string containing html, but only if the tag is within a <div class="nobr"> ….. </div> sequence. I presume the best way is to use preg_replace but I’m having difficulty finding the regex expression to use for the pattern… (there will be multiple line break tags and more than one “nobr” div)
e.g Simple example – From this:
keep this<br>line break<div class="nobr"> but replace this linebreak<br>with a space</div>
To become:
keep this<br>line break<div class="nobr"> but replace this linebreak with a space</div>