code: public boolean checkModuleGroups(String groupname, String moduleNameFormList) {
          String[] mdlPatterns = moduleNameFormList.split(":");
          if (groupList.contains(groupname)) {
              initMessages();
              messages.warning("doclet.Groupname_already_used", groupname);
              return false;
          }
          groupList.add(groupname);
          for (String mdlPattern : mdlPatterns) {
              if (mdlPattern.length() == 0) {
                  initMessages();
                  messages.warning("doclet.Error_in_grouplist", groupname, moduleNameFormList);
                  return false;
              }
              if (mdlPattern.endsWith("*")) {
                  mdlPattern = mdlPattern.substring(0, mdlPattern.length() - 1);
                  if (foundGroupFormat(regExpGroupMap, mdlPattern)) {
                      return false;
                  }
                  regExpGroupMap.put(mdlPattern, groupname);
                  sortedRegExpList.add(mdlPattern);
              } else {
                  if (foundGroupFormat(elementNameGroupMap, mdlPattern)) {
                      return false;
                  }
                  elementNameGroupMap.put(mdlPattern, groupname);
              }
          }
          Collections.sort(sortedRegExpList, new MapKeyComparator());
          return true;
      }
docs: Depending upon the format of the module name provided in the "-group"
  option, generate two separate maps. There will be a map for mapping
  regular expression(only meta character allowed is '*' and that is at the
  end of the regular expression) on to the group name. And another map
  for mapping (possible) module names(if the name format doesn't contain
  meta character '*', then it is assumed to be a module name) on to the
  group name. This will also sort all the regular expressions found in the
  reverse order of their lengths, i.e. longest regular expression will be
  first in the sorted list.
  
  @param groupname       The name of the group from -group option.
  @param moduleNameFormList List of the module name formats.