I need help either adding double quotes for html element attributes that don't contain double quotes or stripping the elements attributes completely. I prefer the former to be given as an answer first, and if it can't be done, then removing the attributes from the html element will do.
I have a pattern that allows me to at least check for all = signs within a single element, but I can't get any further than that.
(<*=(*?)([[:alpha:]])|[[^>|"|'''']]>)
example source string:
<html><body bg= "fff" gg=ddd ss=aa></body></html>
I know that using regex with html is not a good idea but this is a fairly simple regex pattern that should match inside html.
I have managed removing all the attributes from all tags using the below pattern.
using
<\1\2>
as the replace string.