Allow short circuit of testing

When testing long string, we really don't have to check all words, it is
enough to find one matching.

Signed-off-by: Michal Čihař <michal@cihar.com>