import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "((?:(?:(?:(?:Cass\\.?(?:(?:(?:(?: | | |\\\\1e|\\\\1f)*))(?:(?:fr.)|(?:aud\\.(?:(?:(?: | | |\\\\1e|\\\\1f)*))pl(?:é|e|é)n\\.)))?)|(?:C\\.?E\\.?D\\.?H\\.?)|(?:Cour eur\\. D\\.?H\\.?)),?))(?:(?:(?: | | |\\\\1e|\\\\1f)*))(?:(?:(?:1<sup>er?<\\/sup>|[0-9][0-9]?)(?:(?:(?: | | |\\\\1e|\\\\1f)*))(?:janvier|f(?:é|e|é)vrier|mars|avril|mai|juin|juillet|ao(?:û|u|û)t|septembre|octobre|novembre|d(?:é|e|é)cembre|januari|februari|maart|april|mei|juni|juli|augustus|sept(?:ember|\\.)|oktober|nov(?:ember|\\.)|dec(?:ember|\\.))(?:(?:(?: | | |\\\\1e|\\\\1f)*))([1-2][0-9]{3}),?))(?:(?:(?:(?: | | |\\\\1e|\\\\1f)*))(?:[A-Z]+\\.[0-9]+\\.[0-9]+\\.[A-Z]+\\.))?(?:,?(?:(?:(?: | | |\\\\1e|\\\\1f)*))))((?:<[^>]*>)?(?:(?:(?: | | |\\\\1e|\\\\1f)*))(?:Larcier(?:(?:(?: | | |\\\\1e|\\\\1f)*))[Cc]ass(?:ation)?\\.?)(?:(?:(?: | | |\\\\1e|\\\\1f)*))(?:<\\s*\\/[^>]*>)?(?:\\.?,?(?:(?:(?: | | |\\\\1e|\\\\1f)*)))?(?:(?:(?:[nN]rs?\\.?|(?:[nN](?:(?:(?: | | |\\\\1e|\\\\1f)*))<sup>o<\\/sup>\\.?)|[nN](?:(?:(?: | | |\\\\1e|\\\\1f)*))(?:°|˚|o)s?\\.?|[Aa]fl\\.))(?:(?:(?: | | |\\\\1e|\\\\1f)*)))([0-9]+))";
final String string = "C'est dingue que ceci Cass., 7 février 2001, Larcier Cass., n° 481 soit catché !";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
if (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