I think the safest approach would be to apply both conditions separately (but still in the same regex), as below. I modified some of the original pattern near the beginning as I realized it would not be safe for things like:
<table border="0"><tr width="100">
The original pattern would have turned this into
<table border="0"><tr>
This is just an arbitrary example. The corrected pattern below takes this into account as well as incorporating your changes.