This is bugging me the whole day now. Assume this simple non valid HTML
<p clneck="something">my neck hurts</p>
Now I would like to use preg_replace
to replace neck
with head
Of course a simple
preg_replace("/neck/", "head")
would give me
<p clhead="something">my head hurts</p>
I guess you got the point.
I tried the build in DOMDocument, but it failed twice: it's not build for HTML5 and it still failed on some heavenly nested tags.