fixed document typo
improved regex for whitespace