What I’m interested in is a regular expression that will accept HTML input and remove all attributes inside the tag while leaving the tag intact. For example I want this…
<p class="test" id="TestParagraph">This is some test text right here.</p>
To become this…
<p>This is some test text right here.</p>
Any help would be much appreciated.
You really don’t want to use regex for this. HTML is not a regular language, you cannot guarantee that your actual text won’t mimic the tags and be stripped as well. Whatever expression you come up with, there will always be cases that break it.
I would suggest using the Html Agility Pack for any HTML manipulation that you need to do.