code: private String replaceVariablesWithPatterns(String pattern) {
          int group = 0;
          Matcher findVariablesMatcher = variablePattern.matcher(pattern);
          while(findVariablesMatcher.find()) {
              String variable = findVariablesMatcher.group(0);
              pattern = pattern.replaceFirst(variable, "(.+)");
              variableToGroupNumber.put(variable, ++group);
          }
          return pattern;
      }
docs: find and replace any variables in the form