code: @Nonnull
      public static String getPatternStringForSecrets(@Nonnull Collection<String> secrets) {
          List<String> sortedByLength =  new ArrayList<>(secrets);
          Collections.sort(sortedByLength, stringLengthComparator);
          StringBuilder regexp = new StringBuilder();
  
          for (String secret : sortedByLength) {
              if (!secret.isEmpty()) {
                  if (regexp.length() > 0) {
                      regexp.append('|');
                  }
                  regexp.append(Pattern.quote(secret));
              }
          }
          return regexp.toString();
      }
docs: Utility method for turning a collection of secret strings into a single {@link String} for pattern compilation.
  <p>
  Similar to org.jenkinsci.plugins.credentialsbinding.MultiBinding#getPatternStringForSecrets
  
  @param secrets A collection of secret strings
  @return A {@link String} generated from that collection.