public String processPattern(String newPattern) throws IllegalArgumentException {
  int idx=0;
  int offnum=-1;
  StringBuffer outpat=new StringBuffer();
  offsets=new int[BUFSIZE];
  arguments=new String[BUFSIZE];
  maxOffset=-1;
  while (true) {
    int ridx=-1;
    int lidx=newPattern.indexOf(ldel,idx);
    if (lidx >= 0) {
      ridx=newPattern.indexOf(rdel,lidx + ldel.length());
    }
 else {
      break;
    }
    if (++offnum >= BUFSIZE) {
      throw new IllegalArgumentException("TooManyArguments");
    }
    if (ridx < 0) {
      if (exactmatch) {
        throw new IllegalArgumentException("UnmatchedBraces");
      }
 else {
        break;
      }
    }
    outpat.append(newPattern.substring(idx,lidx));
    offsets[offnum]=outpat.length();
    arguments[offnum]=newPattern.substring(lidx + ldel.length(),ridx);
    idx=ridx + rdel.length();
    maxOffset++;
  }
  outpat.append(newPattern.substring(idx));
  return outpat.toString();
}

public String processPattern ( String newPattern ) throws IllegalArgumentException { int idx = 0 ; int offnum = - 1 ; StringBuffer outpat = new StringBuffer ( ) ; offsets = new int [ BUFSIZE ] ; arguments = new String [ BUFSIZE ] ; maxOffset = - 1 ; while ( true ) { int ridx = - 1 ; int lidx = newPattern . indexOf ( ldel , idx ) ; if ( lidx >= 0 ) { ridx = newPattern . indexOf ( rdel , lidx + ldel . length ( ) ) ; } else { break ; } if ( ++ offnum >= BUFSIZE ) { throw new IllegalArgumentException ( "TooManyArguments" ) ; } if ( ridx < 0 ) { if ( exactmatch ) { throw new IllegalArgumentException ( "UnmatchedBraces" ) ; } else { break ; } } outpat . append ( newPattern . substring ( idx , lidx ) ) ; offsets [ offnum ] = outpat . length ( ) ; arguments [ offnum ] = newPattern . substring ( lidx + ldel . length ( ) , ridx ) ; idx = ridx + rdel . length ( ) ; maxOffset ++ ; } outpat . append ( newPattern . substring ( idx ) ) ; return outpat . toString ( ) ; }
scans the pattern and prepares internal variables .
