slight change to pattern parser more robust to spaces