code: public static void addIdToRegexp(final StringBuilder buf, final byte[] id) {
      boolean backslash = false;
      for (final byte b : id) {
        buf.append((char) (b & 0xFF));
        if (b == 'E' && backslash) {  // If we saw a `\' and now we have a `E'.
          // So we just terminated the quoted section because we just added \E
          // to `buf'.  So let's put a literal \E now and start quoting again.
          buf.append("\\\\E\\Q");
        } else {
          backslash = b == '\\';
        }
      }
      buf.append("\\E");
    }
docs: Appends the given UID to the given string buffer, followed by "\\E".
  @param buf The buffer to append
  @param id The UID to add as a binary regex pattern
  @since 2.1