code: public static String replaceAllVariables(String strVars, DriverRequest request) {
          String result = strVars;
          if (VariablesResolver.containsVariable(strVars)) {
              Matcher matcher = VAR_PATTERN.matcher(strVars);
  
              while (matcher.find()) {
                  String group = matcher.group();
                  String var = group.substring(2, group.length() - 1);
                  String arg = null;
  
                  // try to find argument
                  int argIndex = var.indexOf('{');
                  if (argIndex != -1) {
                      arg = VarUtils.removeSimpleQuotes(var.substring(argIndex + 1, var.indexOf('}')));
                  }
  
                  // try to find default value
                  // ESI 1.0 spec :
                  // 4.2 Variable Default Values
                  // Variables whose values are empty, nonexistent variables and
                  // undefined substructures of variables will evaluate to an
                  // empty string when they are accessed.
                  String defaultValue = StringUtils.EMPTY;
                  int defaultValueIndex = var.indexOf('|');
                  if (defaultValueIndex != -1) {
                      defaultValue = VarUtils.removeSimpleQuotes(var.substring(defaultValueIndex + 1));
                  }
  
                  String value = getProperty(var, arg, request);
  
                  if (value == null) {
                      value = defaultValue;
                  }
  
                  result = result.replace(group, value);
  
              }
  
          }
          return result;
      }
docs: Replace all ESI variables found in strVars by their matching value in vars.properties.
  
  @param strVars
  a String containing variables.
  @param request
  @return The resulting String