So someone actually posted a fantastic solution here How can I escape all code within <code></code> tags to allow people to post code?
The problem is that this only works if it's <code></code>
. However, this breaks with <code id="lol"></code
for example, since it contains an attribute. How can I account for this, in order to strictly escape strings inside the code tag, whether or not it has any attributes.
I apologize if there is an obvious solution to this. Regexes give me nightmares.
Edit
As I explained in the question initially, the post that is supposedly a duplicate does not account for the <code>
tag with something like a class or any other attributes.
tags to allow people to post code?](http://stackoverflow.com/questions/9509447/how-can-i-escape-all-code-within-code-code-tags-to-allow-people-to-post-code) – Nicolas Henneaux Aug 30 '16 at 04:26