code: public static List<String> findVars(final String str) {
          final List<String> vars = new ArrayList<String>();
          final char[] strArray = str.toCharArray();
          int i = 0;
          while (i < strArray.length - 1) {
              if (strArray[i] == VAR_START && strArray[i + 1] == VAR_LEFT_BOUND) {
                  i = i + 2;
                  final int begin = i;
                  while (strArray[i] != VAR_RIGHT_BOUND) {
                      ++i;
                  }
                  final String var = str.substring(begin, i++);
                  if (!vars.contains(var)) {
                      vars.add(var);
                  }
              } else {
                  ++i;
              }
          }
          return vars;
      }
docs: Analyze string for variables.
  
  @param str string to analyze
  @return found variable names