in reply to RegEx to filter \s not between labels

Okay, I think this one looks good too:
s[(STARTPRESERVE.*?STOPPRESERVE)|(\s+)|(.)] [($1||'') . ($2?' ':'') . ($3||'')]eg;
The ||'' is to avoid the warnings.

Update: And this is of course wrong, since I'm testing with || and should do defined instead.

Update2: This is a correct and shorter version:

s#(STARTPRESERVE.*?STOPPRESERVE)|(\s+)|(.)#$1?$1:$2?' ':$3#eg;
because $1 and $2 can both be tested for truth.

Update3 (ouch):

s#(STARTPRESERVE.*?STOPPRESERVE)|(\s+)#$1?$1:$2?' ':''#eg;
Now this looks alot like tye's suggestion except for elimination of defined :-(