String (@NotNull List<Substring> lines) { for (Substring line : lines) { Matcher matcher = REDIRECT.matcher(line); if (matcher.matches() && matcher.groupCount() > 0) { return matcher.group(1); } } return null; }