docs: private Set<String> variantsFor(String input) {
          // Store current invocation's results
          Set<String> variants = new HashSet<>();
  
          Matcher m = regex.matcher(input);
          boolean matches = m.matches();
  
          if (!matches) {
              // if the regex does not find any patterns,
              // simply add the input as is
              variants.add(input);
              // end recursion
              return variants;
          }
  
          // isolate the part before the first pattern
          String head = m.group(1);
  
          // isolate the pattern itself, removing its wrapping {}
          String patternGroup = m.group(2).replaceAll("[\\{\\}]", "");
  
          // isolate the remaining part of the input
          String tail = m.group(6);
  
          // split the pattern into its options and add an empty
          // string if it ends with a separator
          List<String> patternParts = new ArrayList<>();
          patternParts.addAll(asList(patternGroup.split("\\|")));
          if (patternGroup.endsWith("|")) {
              patternParts.add("");
          }
  
          // Iterate over the current pattern's
          // variants and construct the result.
          for (String part : patternParts) {
              StringBuilder builder = new StringBuilder();
              if (head != null) {
                  builder.append(head);
              }
              builder.append(part);
  
              // recurse on the tail of the input
              // to handle the next pattern
              Set<String> tails = variantsFor(tail);
  
              // append all variants of the tail end
              // and add each of them to the part we have
              // built up so far.
              for (String tailVariant : tails) {
                  StringBuilder tailBuilder = new StringBuilder(builder.toString());
                  tailBuilder.append(tailVariant);
                  variants.add(tailBuilder.toString());
              }
          }
          return variants;
      }