If you want to know why, then I recommend you get a copy of Jeffrey Friedl's book "Mastering Regular Expressions". It explains exactly how this sort of thing works and the how to develop regular expressions efficiently.
Comment on Re: Re: Re: remove both leading and trailing spaces