The problem isn't leading spaces. Leading spaces are terribly easy:
^\s+ says "find the beginning of the string and one or more spaces". It's trailing spaces that are hideous. Instead of
\s+$ meaning "find the end of the string, and one or more spaces before it", it means "find one or more spaces, and then try for the end of the string". That's sad of it.
_____________________________________________________
Jeff japhy Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;