match on words rather than split on whitespace

avoids trailing whitespace bugs