[
https://issues.apache.org/jira/browse/TEXT-232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory updated TEXT-232:
---------------------------------
Description:
{{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.
was:
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.
> WordUtils.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
> Priority: Minor
>
> {{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)