import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "https:\\/\\/www\\.chytryhonza\\.cz\\/(hypoteka|americka-hypoteka|refinancovani-hypoteky).*";
final String string = "https://www.chytryhonza.cz/hypotecni-kalkulacka?v=iTBDcj1Zi0eb4mSEPe3k3CNWhpqvaZmAyRTmCq%2Be1j085RJkWNTwLmXX8mRWLjvUDUxgpyVpx0VS0q08qi%2FTIvRBMeiXW4w9fK%2F8cQg4wXlsDubtLGXAdytQCNC2LTfF\n"
+ "https://www.chytryhonza.cz/hypotecni-kalkulacka?v=\n"
+ "https://www.chytryhonza.cz/srovnavac\n"
+ "https://www.chytryhonza.cz/srovnavac-zivotniho-pojisteni?v=dd\n"
+ "https://www.chytryhonza.cz/srovnavac-zivotniho-pojisteni?v=1qC3j5r%2BHim0K68IAcodRMrYv6ikx0NneJC39H2oOdl2H8QZ5DL9glGwRtkQSV%2BhVT0c%2B95YLTSmA4BDugvpUQkWIDUmTmv4rcg1t78EMid9jhDOoHh%2BXxRZAxYBGKkB\n\n"
+ "https://www.chytryhonza.cz/hypoteka\n"
+ "https://www.chytryhonza.cz/hypoteka#aca30160bd78b\n"
+ "https://www.chytryhonza.cz/americka-hypoteka\n"
+ "https://www.chytryhonza.cz/refinancovani-hypoteky\n"
+ "https://www.chytryhonza.cz/zivot\n";
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