Yep, regex won't work anyway in this case. I think the OP would just a quick answer to his actual question and need to dig around by himself for the why's.
– EricLavaultJan 08 '20 at 13:41
Don't be sorry we know this in the first place, not to repeat myself but in this case : *regex won't work anyway* for parsing self-contained tags, so why arguing ? Just close the question. OR, give an *imperfect* answer with a working solution, at least for the OP original and simple use case, as limited as it is, because the OP *actually asked* how to perform a simple HTML replacement using preg_replace(), you know. Saying *You can't perfectly parse HTML with RegEx* is very nice, though it doesn't answer the question nor suggest any concrete alternative and sounds like a duplicate. But nice.
– EricLavaultJan 09 '20 at 08:07
@EricLavault by *you can't* I meant *one can't*, you know, french litteral translations
– CidJan 09 '20 at 09:05