throw new Exception("bad regexp");
throw new QuercusException("bad regexp");
    compileReplacement(Env env, String replacement, boolean isEval)    throws Exception  {    ArrayList<Replacement> program = new ArrayList<Replacement>();    StringBuilder text = new StringBuilder();    for (int i = 0; i < replacement.length(); i++) {      char ch = replacement.charAt(i);      if ((ch == '\\' || ch == '$') && i + 1 < replacement.length()) {        char digit;        if ('0' <= (digit = replacement.charAt(i + 1)) && digit <= '9') {          int group = digit - '0';          i++;          if (i + 1 < replacement.length() &&              '0' <= (digit = replacement.charAt(i + 1)) && digit <= '9') {            group = 10 * group + digit - '0';            i++;          }          if (text.length() > 0)            program.add(new TextReplacement(text));	  if (isEval)	    program.add(new GroupEscapeReplacement(group));	  else	    program.add(new GroupReplacement(group));          text.setLength(0);        }	else if (ch == '\\') {          i++;	  if (digit != '\\') {	    text.append('\\');	  }          text.append(digit);      // took out test for ch == '$' because must be true      //} else if (ch == '$' && digit == '{') {        } else if (digit == '{') {          i += 2;          int group = 0;          while (i < replacement.length() &&                 '0' <= (digit = replacement.charAt(i)) && digit <= '9') {            group = 10 * group + digit - '0';            i++;          }          if (digit != '}') {            env.warning(L.l("bad regexp {0}", replacement));            throw new Exception("bad regexp");          }          if (text.length() > 0)            program.add(new TextReplacement(text));	  if (isEval)	    program.add(new GroupEscapeReplacement(group));	  else	    program.add(new GroupReplacement(group));	            text.setLength(0);        }        else          text.append(ch);      }      else        text.append(ch);    }    if (text.length() > 0)      program.add(new TextReplacement(text));    return program;  }