filter() + match() does not work

filter() + match() does not work

Assume I have a webpage with lots of lines similar to

  1. <tr>   <td>   </td>   </tr>

The tags avove could be spread over multiple lines.

Between them could be zero, one or more whitespaces.

I want to get rid of them all.

Therefore I coded the following two jQuery statements:

  1. $("td").filter( function(){ return $(this).html().match(/^\s*$/) }).remove();
  2. $("tr").filter( function(){ return $(this).html().match(/^\s*$/) }).remove();

The first should remove all inner <td>   </td>  occurencies.

The last then all remaining (now empty) <tr>    </tr> occurencies.

But this seems NOT to work.

Whats worng?

How can I achieve this otherwise?

Does \s really represent all whitespace?

Where is a list of all possible special chars in the match() statement?

Peter