Arnout Engelen created TEXT-232:
-----------------------------------

             Summary: containsAllWords​ may throw PatternSyntaxException
                 Key: TEXT-232
                 URL: https://issues.apache.org/jira/browse/TEXT-232
             Project: Commons Text
          Issue Type: Wish
            Reporter: Arnout Engelen


WordUtils.containsAllWords checks if the String contains all words in the given 
array.

Surprisingly, it interprets the words to be searched for as regular 
expressions, so for example searching for ")" would throw a 
PatternSyntaxException. Nothing in the javadoc nor the testcases suggests this 
is intentional.

We could fix this by applying "{{{}Pattern.quote(){}}}" to the parameters, or 
by rejecting non-word characters outright.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to