Regex trim or preg_replace white space including tabs and new lines
How can I use PHP to trim all white space up to "poo" and all white space afterwards? I would like to turn this: <code><div class="b-line"></div> \t \n\n\n \t \n poo <lol> n \n \n \t </code> In to this: <code><div class="b-line"></div>poo <lol> n</code> This part will always be at the start of the string: <code><div class="b-line"></div> Thanks Edit: Sorry I should explain that the whole of the above is in a string and I only want to trim the whitespace immediately after <code><div class="b-line"></div> and immediately before </code> I think this lookahead and lookbehind based regex will work