oh, yeah, thanks a lot, this saved my ***.
BTW, the expression had a quirk. It was cutting the last letter from all tags that had no attributes, but this problem has a very easy solution:
Notice i added a space between w+) and [^. I'm not sure how good this solution is, but it works for me.