throws Throwable
  public static String preg_quote(String string,                                  @Optional String delim)    throws Throwable  {    StringBuilder sb = new StringBuilder();    boolean []extra = null;    if (delim != null && ! delim.equals("")) {      extra = new boolean[256];      for (int i = 0; i < delim.length(); i++)        extra[delim.charAt(i)] = true;    }    int length = string.length();    for (int i = 0; i < length; i++) {      char ch = string.charAt(i);      if (ch >= 256)        sb.append(ch);      else if (PREG_QUOTE[ch]) {        sb.append('\\');        sb.append(ch);      }      else if (extra != null && extra[ch]) {        sb.append('\\');        sb.append(ch);      }      else        sb.append(ch);    }    return sb.toString();  }