I have a file with huge if statements like this:
if ((Pattern.compile("string1|String2|String3").matcher(text_str).find())
&& (Pattern.compile("String4|String5").matcher(text_str).find())
&& (Pattern.compile("String6|String7|String8").matcher(text_str).find())
&& (Pattern.compile("String9|String10").matcher(text_str).find())
&& (Pattern.compile("String11|String12").matcher(text_str).find())
&& (Pattern.compile("String13|String14").matcher(text_str).find())
&& (Pattern.compile("String15|String16").matcher(text_str).find())
&& (Pattern.compile("String17|String18").matcher(text_str).find())
&& (Pattern.compile("String19|String19|String20").matcher(text_str).find())
) {
return true;
}
I basically need to do checks for a strings like (Pseudocode):
String contains? (I have a) AND (cat OR dog OR fish) AND (and it) AND (eats OR drinks OR smells) AND (funny OR a lot OR nothing)
how would I make this more maintainable and efficient with a very big amount of checks?
\d, etc)?