index = getCharUnit(input,index,unit);
index = getCharUnit(input,index,unit,false);
  private int getMinMax(char[] input,int index,IntPair minMax,RESyntax syntax) throws REException {    // Precondition: input[index-1] == '{', minMax != null    boolean mustMatch = !syntax.get(RESyntax.RE_NO_BK_BRACES);    int startIndex = index;    if (index == input.length) {      if (mustMatch)        throw new REException(getLocalizedMessage("unmatched.brace"),REException.REG_EBRACE,index);      else        return startIndex;    }        int min,max=0;    CharUnit unit = new CharUnit();    StringBuffer buf = new StringBuffer();        // Read string of digits    do {      index = getCharUnit(input,index,unit);      if (Character.isDigit(unit.ch))        buf.append(unit.ch);    } while ((index != input.length) && Character.isDigit(unit.ch));    // Check for {} tomfoolery    if (buf.length() == 0) {      if (mustMatch)        throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);      else        return startIndex;    }    min = Integer.parseInt(buf.toString());	    if ((unit.ch == '}') && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ unit.bk))      max = min;    else if (index == input.length)      if (mustMatch)        throw new REException(getLocalizedMessage("interval.no.end"),REException.REG_EBRACE,index);      else        return startIndex;    else if ((unit.ch == ',') && !unit.bk) {      buf = new StringBuffer();      // Read string of digits      while (((index = getCharUnit(input,index,unit)) != input.length) && Character.isDigit(unit.ch))	buf.append(unit.ch);      if (!((unit.ch == '}') && (syntax.get(RESyntax.RE_NO_BK_BRACES) ^ unit.bk)))        if (mustMatch)          throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);        else          return startIndex;      // This is the case of {x,}      if (buf.length() == 0) max = Integer.MAX_VALUE;      else max = Integer.parseInt(buf.toString());    } else      if (mustMatch)        throw new REException(getLocalizedMessage("interval.error"),REException.REG_EBRACE,index);      else        return startIndex;    // We know min and max now, and they are valid.    minMax.first = min;    minMax.second = max;    // return the index following the '}'    return index;  }