I\'m trying to write a regular expression that will strip all tag attributes except for the SRC attribute. For example:
You usually should not parse HTML using regular expressions.
Instead, you should call DOMDocument::loadHTML. You can then recurse through the elements in the document and call removeAttribute.
removeAttribute