docs: public static String getRowKeyUIDRegex(
        final List<byte[]> group_bys, 
        final ByteMap<byte[][]> row_key_literals, 
        final boolean explicit_tags,
        final byte[] fuzzy_key, 
        final byte[] fuzzy_mask) {
      if (group_bys != null) {
        Collections.sort(group_bys, Bytes.MEMCMP);
      }
      final int prefix_width = Const.SALT_WIDTH() + TSDB.metrics_width() + 
          Const.TIMESTAMP_BYTES;
      final short name_width = TSDB.tagk_width();
      final short value_width = TSDB.tagv_width();
      final short tagsize = (short) (name_width + value_width);
      // Generate a regexp for our tags.  Say we have 2 tags: { 0 0 1 0 0 2 }
      // and { 4 5 6 9 8 7 }, the regexp will be:
      // "^.{7}(?:.{6})*\\Q\000\000\001\000\000\002\\E(?:.{6})*\\Q\004\005\006\011\010\007\\E(?:.{6})*$"
      final StringBuilder buf = new StringBuilder(
          15  // "^.{N}" + "(?:.{M})*" + "$"
          + ((13 + tagsize) // "(?:.{M})*\\Q" + tagsize bytes + "\\E"
             * ((row_key_literals == null ? 0 : row_key_literals.size()) + 
                 (group_bys == null ? 0 : group_bys.size() * 3))));
      // In order to avoid re-allocations, reserve a bit more w/ groups ^^^
  
      // Alright, let's build this regexp.  From the beginning...
      buf.append("(?s)"  // Ensure we use the DOTALL flag.
                 + "^.{")
         // ... start by skipping the salt, metric ID and timestamp.
         .append(Const.SALT_WIDTH() + TSDB.metrics_width() + Const.TIMESTAMP_BYTES)
         .append("}");
  
      final Iterator<Entry<byte[], byte[][]>> it = row_key_literals == null ? 
          new ByteMap<byte[][]>().iterator() : row_key_literals.iterator();
      int fuzzy_offset = Const.SALT_WIDTH() + TSDB.metrics_width();
      if (fuzzy_mask != null) {
        // make sure to skip the timestamp when scanning
        while (fuzzy_offset < prefix_width) {
          fuzzy_mask[fuzzy_offset++] = 1;
        }
      }
      
      while(it.hasNext()) {
        Entry<byte[], byte[][]> entry = it.hasNext() ? it.next() : null;
        // TODO - This look ahead may be expensive. We need to get some data around
        // whether it's faster for HBase to scan with a look ahead or simply pass
        // the rows back to the TSD for filtering.
        final boolean not_key = 
            entry.getValue() != null && entry.getValue().length == 0;
        
        // Skip any number of tags.
        if (!explicit_tags) {
          buf.append("(?:.{").append(tagsize).append("})*");
        } else if (fuzzy_mask != null) {
          // TODO - see if we can figure out how to improve the fuzzy filter by
          // setting explicit tag values whenever we can. In testing there was
          // a conflict between the row key regex and fuzzy filter that prevented
          // results from returning properly.
          System.arraycopy(entry.getKey(), 0, fuzzy_key, fuzzy_offset, name_width);
          fuzzy_offset += name_width;
          for (int i = 0; i < value_width; i++) {
            fuzzy_mask[fuzzy_offset++] = 1;
          }
        }
        if (not_key) {
          // start the lookahead as we have a key we explicitly do not want in the
          // results
          buf.append("(?!");
        }
        buf.append("\\Q");
        
        addId(buf, entry.getKey(), true);
        if (entry.getValue() != null && entry.getValue().length > 0) {  // Add a group_by.
          // We want specific IDs.  List them: /(AAA|BBB|CCC|..)/
          buf.append("(?:");
          for (final byte[] value_id : entry.getValue()) {
            if (value_id == null) {
              continue;
            }
            buf.append("\\Q");
            addId(buf, value_id, true);
            buf.append('|');
          }
          // Replace the pipe of the last iteration.
          buf.setCharAt(buf.length() - 1, ')');
        } else {
          buf.append(".{").append(value_width).append('}');  // Any value ID.
        }
        
        if (not_key) {
          // be sure to close off the look ahead
          buf.append(")");
        }
      }
      // Skip any number of tags before the end.
      if (!explicit_tags) {
        buf.append("(?:.{").append(tagsize).append("})*");
      }
      buf.append("$");
      return buf.toString();
    }