fix pattern matches on incomplete strings