int (@NotNull Matcher matcher, int group) { if (group > matcher.groupCount() + 1) { return 0; } final String match = matcher.group(group); if (match == null) { return 0; } return Integer.parseInt(match); }