code: protected static void buildRegex(Node alt, StringBuilder sb) {
          String close = null;
          if (alt.cs != null) {
              // actually '!' always be the first character, because it is
              // always used along with '*'.
              for (int i = 0; i < alt.cs.length(); i++) {
                  char c = alt.cs.charAt(i);
                  if (c == '!') {
                      if (close != null)
                          throw new RuntimeException("more than one '!'");
                      sb.append("(?=");
                      close = ")";
                  } else if (c == '*') {
                      sb.append("[-\\w]+");
                  } else {
                      sb.append(c);
                  }
              }
          }
          if (alt.branches != null) {
              // alt.branches.size() should always be > 1
              if (alt.branches.size() > 1) {
                  sb.append("(?:");
              }
              String sep = "";
              for (Node alt1 : alt.branches) {
                  sb.append(sep); sep = "|";
                  buildRegex(alt1, sb);
              }
              if (alt.branches.size() > 1) {
                  sb.append(")");
              }
          }
          if (close != null)
              sb.append(close);
      }
docs: bulids regular expression from prefix-tree {@code alt} into buffer {@code sb}.
  @param alt prefix tree root.
  @param sb StringBuffer to store regular expression.