docs: public static VariableSet findVariableSet(final String input, final char startDelim, final char endDelim, final int startPos) {
          final int startIndex = StringUtilities.indexOf(input, startDelim, startPos);
          int endIndex = StringUtilities.indexOf(input, endDelim, startIndex == -1 ? startPos : startIndex);
          int nextStartIndex = startIndex == -1 ? -1 : StringUtilities.indexOf(input, startDelim, startIndex + 1);
  
          /*
           * Find the ending delimiter that matches the start delimiter. This is done
           * by checking to see if the next start delimiter is before the current end
           * delimiter. If that is the case then there is a nested set so look for the
           * next end delimiter.
           */
          while (nextStartIndex < endIndex && nextStartIndex != -1 && endIndex != -1) {
              final int prevEndIndex = endIndex;
              endIndex = StringUtilities.indexOf(input, endDelim, endIndex + 1);
              nextStartIndex = StringUtilities.indexOf(input, startDelim, prevEndIndex + 1);
          }
  
          // Build the resulting set object
          final VariableSet set = new VariableSet();
  
          if (endIndex == -1 && startIndex != -1) {
              set.setContents(input.substring(startIndex));
              set.setEndPos(null);
              set.setStartPos(startIndex);
          } else if (startIndex != -1) {
              if (endIndex == -1) {
                  set.setContents(input.substring(startIndex));
              } else {
                  set.setContents(input.substring(startIndex, endIndex + 1));
              }
              set.setEndPos(endIndex);
              set.setStartPos(startIndex);
          } else if (endIndex != -1) {
              set.setContents(input.substring(startPos, endIndex + 1));
              set.setEndPos(endIndex);
              set.setStartPos(null);
          } else {
              String remainingData = input.substring(startPos);
              if (!remainingData.trim().isEmpty()) {
                  set.setContents(remainingData);
                  set.setEndPos(input.length() - 1);
              } else {
                  set.setContents(null);
                  set.setEndPos(null);
              }
              set.setStartPos(null);
          }
          return set;
      }