I have the following code: if (kFields.contains(field)) { doc.add(Field.UnStored("contentKeywords", value)); } if (cFields.contains(field)) { doc.add(Field.UnStored("contentContents", value)); } Basically if kFields, cFields contain field I enter the if condition. My boss wants me to add a regular expression to kField. Example: kField would contain among other things: TEXT* The desired effect is in the if statement above, if field contains TEXT1, TEXT2...TEXT ...