public Object delete(String re){
  Object o=null;
  RegexpNode p=prefixMachine;
  RegexpNode best=p;
  int len=re.length() - 1;
  int i;
  boolean prefix=true;
  if (!re.startsWith("*") || !re.endsWith("*"))   len++;
  if (len <= 0)   return null;
  for (i=0; p != null; i++) {
    if (p.result != null && p.depth < BIG && (!p.exact || i == len)) {
      best=p;
    }
    if (i >= len)     break;
    p=p.find(re.charAt(i));
  }
  p=suffixMachine;
  for (i=len; --i >= 0 && p != null; ) {
    if (p.result != null && p.depth < BIG) {
      prefix=false;
      best=p;
    }
    p=p.find(re.charAt(i));
  }
  if (prefix) {
    if (re.equals(best.re)) {
      o=best.result;
      best.result=null;
    }
  }
 else {
    if (re.equals(best.re)) {
      o=best.result;
      best.result=null;
    }
  }
  return o;
}

public Object delete ( String re ) { Object o = null ; RegexpNode p = prefixMachine ; RegexpNode best = p ; int len = re . length ( ) - 1 ; int i ; boolean prefix = true ; if ( ! re . startsWith ( "*" ) || ! re . endsWith ( "*" ) ) len ++ ; if ( len <= 0 ) return null ; for ( i = 0 ; p != null ; i ++ ) { if ( p . result != null && p . depth < BIG && ( ! p . exact || i == len ) ) { best = p ; } if ( i >= len ) break ; p = p . find ( re . charAt ( i ) ) ; } p = suffixMachine ; for ( i = len ; -- i >= 0 && p != null ; ) { if ( p . result != null && p . depth < BIG ) { prefix = false ; best = p ; } p = p . find ( re . charAt ( i ) ) ; } if ( prefix ) { if ( re . equals ( best . re ) ) { o = best . result ; best . result = null ; } } else { if ( re . equals ( best . re ) ) { o = best . result ; best . result = null ; } } return o ; }
delete the regular expression and its target .
