import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(Knowledge.*)|(some time knowledge.*)|(data after knowledge.*)";
final String string = "Requirements\n\n"
+ "· Completed or close to completing of relevant Microsoft 365 certifications (Essential)\n\n"
+ "· Diploma or degree in Information Technology, Computer Studies or a related field (Preferred)\n\n"
+ "· At least 5 years’ work experience in IT/IT support with minimum 3 years in a Microsoft 365 Engineering/Admin role (Essential)\n\n"
+ "· Knowledge and experience in administering and supporting Microsoft Windows 10 (Essential)\n\n"
+ "· some time knowledge and experience in administering and supporting Microsoft 365, Exchange Online, Teams, and other Office 365 tools (Essential)\n\n"
+ "· data after knowledge and experience in administering and supporting SharePoint Online (Preferred)\n\n"
+ "· Knowledge and experience in administering and supporting Microsoft Dynamics 365 and Business Central (Preferred)\n\n"
+ "· Strong team player with good oral and written communication and interpersonal skills (Essential) ";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html