Trim whitespace; Fixed regex.  See pull request for explanation.