List<String> (@NotNull Matcher matcher) { final List<String> result = new ArrayList<>(); final String srcBefore = matcher.group(VCS_SRC_BEFORE_GROUP); if (srcBefore != null) { result.addAll(Arrays.asList(srcBefore.split("\\s+"))); } final String editable = matcher.group(VCS_EDITABLE_GROUP); if (editable != null) { result.add(editable); } result.add(matcher.group(VCS_GROUP)); final String srcAfter = matcher.group(VCS_SRC_AFTER_GROUP); if (srcAfter != null) { result.addAll(Arrays.asList(srcAfter.split("\\s+")).subList(1, 3)); // skip spaces before --src and get only two values } return result; }