code: private static String surtPrefixRegexFromTrie(Node trie) {
          StringBuilder regex = new StringBuilder();
          regex.append("(?ix)^\n");
          trie.addBranch("*,"); // for new/unknown TLDs
          buildRegex(trie, regex);
          regex.append("\n([-\\w]+,)");
          return regex.toString();
      }
docs: Converts SURT-ordered list of public prefixes into a Java regex which
  matches the public-portion "plus one" segment, giving the domain on which
  cookies can be set or other policy grouping should occur. Also adds to
  regex a fallback matcher that for any new/unknown TLDs assumes the
  second-level domain is assignable. (Eg: 'zzz,example,').
  
  @param list
  @return