Note that this is only true for the literal asterisk character. For wildcards you should the regex after the update.
You don't need regular expressions for this, just two str_replace()
$html = str_replace (' height="*"', ' height="auto"', $html);
$html = str_replace (' width="*"', ' width="auto"', $html);
Update
You can use RegEx though. It requires more resources, but some rudamentary checks can be added (so for example height="*"
won't be changed when NOT inside an element):
preg_replace ('/(<[^>]+ (height|width)=)"[^"]*"/i', '$1"auto"', $html);