update: After seeing thinker's reply I realized I might have misunderstood the question. If, like he suggests, you mean to remove leading and trailing whitespace from each line of a multi-line string, then I'd change the second line above to:s/^\s+//; s/\s+$//;
s/\s*\n\s*/\n/g;
In reply to Re: trim leading & trailing whitespace
by graff
in thread trim leading & trailing whitespace
by ady
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |