protected List<String> getRegexGroups(String regExpKey, String id) {
    Pattern pattern = patterns.get(regExpKey);
    List<String> regexGroups = new ArrayList<>();

    if (pattern != null) {
      Matcher matcher = pattern.matcher(id);

      if (matcher.matches()) {
        for (int i=0; i<matcher.groupCount(); i++){
          regexGroups.add(matcher.group(i + 1));
        }
      }
    }

    return regexGroups;
  }
Extracts set of matcher.group() from id
@param regExpKey
@param id
@return extracted regex groups from id
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseProvider.java