code: public List<Map<String, String>> namedGroups() {
          List<Map<String, String>> result = new ArrayList<Map<String, String>>();
          List<String> groupNames = parentPattern.groupNames();
  
          if (groupNames.isEmpty()) {
              return result;
          }
  
          int nextIndex = 0;
          while (matcher.find(nextIndex)) {
              Map<String, String> matches = new LinkedHashMap<String, String>();
  
              for (String groupName : groupNames) {
                  String groupValue = matcher.group(groupIndex(groupName));
                  matches.put(groupName, groupValue);
                  nextIndex = matcher.end();
              }
  
              result.add(matches);
          }
          return result;
      }
docs: Finds all named groups that exist in the input string. This resets the
  matcher and attempts to match the input against the pre-specified
  pattern.
  
  @return a list of maps, each containing name-value matches
  (empty if no match found).
  
  Example:
  pattern:  (?&lt;dote&gt;\d+).(?&lt;day&gt;\w+)
  input:    1 Sun foo bar 2 Mon foo
  output:   [{"date":"1", "day":"Sun"}, {"date":"2", "day":"Mon"}]