class PathElement {

   public String resolve(String name, String path)
   {
      Matcher matcher = pattern.matcher(path);
      int start = 0;
      if (path.charAt(0) == '/') start++;

      for (Group group : groups)
      {
         if (matcher.find(start) && group.name.equals(name))
         {
            String s = matcher.group(group.group);
            if ("".equals(s)) return null;

            return s;
         }
      }

      return null;
   }

   public  PathElement(String value, List<Group> groups, String regex);

}