The problem
My regex below for a PHP preg_replace works great
'|(?<!</h2>)\s*
(?!<h2>)|'
However I would much rather the 'h2' part be a section which searches for any of 'h2|p|li|div' etc, just whatever it can find out of the choices I give it.
I have tried all sorts like
'|(?<!</(?:h2|p|li|div)>)\s*
(?!<(?:h2|p|li|div)>)|'
But it just will not seem to work.
This would be a great help if anyone can point me in the correct direction as I am working this out as an alternative to a problem I posted yesterday.
Extra notes
My aim for the code BTW is to FIND ALL LINE BREAKS ( ) that DO NOT have a /h2 or /p etc BEFORE the line break and DO NOT have a h2 or p etc AFTER the linebreak. So....
example
<- find this
example
<- find this
example
<- not this (as <h2> next starts line)
<h2>example
<- find this
example</h2>
<- not this (as </h2> ends this line)
example
<- find this
Many many thanks,