I can't think of anything other than a three-pass operation that would first change any of those characters within textarea tags to some sort of place-holders, then doing the global replace, and then replacing those first-pass place-holders with the original characters -- at which point you are probably spending more time doing all that processing than the millisecond or two of time you saved in HTTP request time by stripping out that white space. (In fact, it would be interesting to put some metering on it as is and see if you are actually saving time with just the single-pass replacement you're doing now.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
By the way, the hope for a simple answer doesn't guarantee a non-thinker is asking the question.
You do realize that's part of my forum signature and not directed specifically at you, right?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
A thought, if you're mainly concerned with newlines/tabs between HTML elements, not within them:
PHP Code:
<?php
$buffer = <<<EOD
<p>blah blah blah</p>
<p>blah blah blah, too</p>
<textarea name='foo'>Text
text text
indented text
end of text</textarea>
<p>the end</p>
EOD;
<p>blah blah blah</p><p>blah blah blah, too</p><textarea name='foo'>Text
text text
indented text
end of text</textarea><p>the end</p>
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks