This question is for general purpose, and no, “you should never regex html”…
What is the regex to remove an empty attribute, such as
class="" or class=" "
without knowing the number of whitespaces inbetween ” “?
Plus: Leaving the class tag untouched if there are other chars inside?
I got a solution for complicated regex yesterday, however, I was not able to strip that down to the specific case mentioned above.
Thank you!
Try with the following regex: