How to remove empty <p>...</p> but with possible attributes?

How to remove empty <p>...</p> but with possible attributes?

Assume I have the following simplified source code:

  1. <p> </p>
  2. <p style="line-height: 12px;"> </p>
Both <p>s contain inside only whitespace chars. Here it is a blank. It could be a tab or nbsp as well.

Now I wan to remove all empty <p>s resp all those which contain only whitespaces.

When I try the following (pure Javascript) code:
 
  1. document.body.innerHTML=document.body.innerHTML.replace(/<p>(\s*|&nbsp;|&tab;)<\/p>/g,"");

then only the first <p>...</p> is removed.

How can I extend the command that the second <p .....>...</p> is covered as well?

Is there a better jQuery command?