docs: @Override
      public Optional<UriMatchInfo> match(String uri) {
          if (uri == null) {
              throw new IllegalArgumentException("Argument 'uri' cannot be null");
          }
          if (uri.length() > 1 && uri.charAt(uri.length() - 1) == '/') {
              uri = uri.substring(0, uri.length() - 1);
          }
  
          int len = uri.length();
          if (isRoot && (len == 0 || (len == 1 && uri.charAt(0) == '/'))) {
              return Optional.of(new DefaultUriMatchInfo(uri, Collections.emptyMap(), variables));
          }
          //Remove any url parameters before matching
          int parameterIndex = uri.indexOf('?');
          if (parameterIndex > -1) {
              uri = uri.substring(0, parameterIndex);
          }
          Matcher matcher = matchPattern.matcher(uri);
          if (matcher.matches()) {
              if (variables.isEmpty()) {
                  return Optional.of(new DefaultUriMatchInfo(uri, Collections.emptyMap(), variables));
              } else {
                  Map<String, Object> variableMap = new LinkedHashMap<>();
                  int count = matcher.groupCount();
                  for (int j = 0; j < variables.size(); j++) {
                      int index = (j * 2) + 2;
                      if (index > count) {
                          break;
                      }
                      UriMatchVariable variable = variables.get(j);
                      String value = matcher.group(index);
                      variableMap.put(variable.getName(), value);
                  }
                  return Optional.of(new DefaultUriMatchInfo(uri, variableMap, variables));
              }
          }
          return Optional.empty();
      }