in reply to RegEx to filter \s not between labels
The ||'' is to avoid the warnings.s[(STARTPRESERVE.*?STOPPRESERVE)|(\s+)|(.)] [($1||'') . ($2?' ':'') . ($3||'')]eg;
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:
because $1 and $2 can both be tested for truth.s#(STARTPRESERVE.*?STOPPRESERVE)|(\s+)|(.)#$1?$1:$2?' ':$3#eg;
Update3 (ouch):
Now this looks alot like tye's suggestion except for elimination of defined :-(s#(STARTPRESERVE.*?STOPPRESERVE)|(\s+)#$1?$1:$2?' ':''#eg;
|
|---|