I know that regex usually should not be used for parsing html content. In my special case i need them
(reason is, am using a rte editor and when pasting into the editor some replacement for attributes of paragraphs needs to be done).
I have something like
<p attribute1="val1" attribute2="val2" attribut="val3" ...>text blah blah</p>
and i need all attributes stripped out so that i get
<p>text blah blah</p>
How can this be done using a regex?
A solution to strip out attributes from all possible html tags is appreciated too.
Something like this should work on all tags:
For paragraphs only, just replace the
\w:The
\s*in the beginning allows for whitespace before the tag name, so if you for some reason have< p class="foo">, it works on that too.