while (--posIndex >= min) {
int indexCount = posIndex - min; if (indexCount <= 0) {     indexCount = 1; } while (indexCount-- > 0) { --posIndex;
    boolean match(CharIndexed input, REMatch mymatch) {	// number of times we've matched so far	int numRepeats = 0; 		// Possible positions for the next repeat to match at	REMatch newMatch = mymatch;	REMatch last = null;	REMatch current;	// Add the '0-repeats' index	// positions.elementAt(z) == position [] in input after <<z>> matches	Vector positions = new Vector();	positions.addElement(newMatch);		// Declare variables used in loop	REMatch doables;	REMatch doablesLast;	REMatch recurrent;	do {	    // Check for stingy match for each possibility.	    if (stingy && (numRepeats >= min)) {		REMatch result = matchRest(input, newMatch);		if (result != null) {		    mymatch.assignFrom(result);		    return true;		}	    }	    doables = null;	    doablesLast = null;	    // try next repeat at all possible positions	    for (current = newMatch; current != null; current = current.next) {		recurrent = (REMatch) current.clone();		if (token.match(input, recurrent)) {		    // add all items in current to doables array		    if (doables == null) {			doables = recurrent;			doablesLast = recurrent;		    } else {			// Order these from longest to shortest			// Start by assuming longest (more repeats)			doablesLast.next = recurrent;		    }		    // Find new doablesLast		    while (doablesLast.next != null) {			doablesLast = doablesLast.next;		    }		}	    }	    // if none of the possibilities worked out, break out of do/while	    if (doables == null) break;	    	    // reassign where the next repeat can match	    newMatch = doables;	    	    // increment how many repeats we've successfully found	    ++numRepeats;	    	    positions.addElement(newMatch);	} while (numRepeats < max);		// If there aren't enough repeats, then fail	if (numRepeats < min) return false;		// We're greedy, but ease off until a true match is found 	int posIndex = positions.size();		// At this point we've either got too many or just the right amount.	// See if this numRepeats works with the rest of the regexp.	REMatch allResults = null;	REMatch allResultsLast = null;	REMatch results = null;	while (--posIndex >= min) {	    newMatch = (REMatch) positions.elementAt(posIndex);	    results = matchRest(input, newMatch);	    if (results != null) {		if (allResults == null) {		    allResults = results;		    allResultsLast = results;		} else {		    // Order these from longest to shortest		    // Start by assuming longest (more repeats)		    allResultsLast.next = results;		}		// Find new doablesLast		while (allResultsLast.next != null) {		    allResultsLast = allResultsLast.next;		}	    }	    // else did not match rest of the tokens, try again on smaller sample	    // or break out when performing possessive matching	    if (possessive) break;	}	if (allResults != null) {	    mymatch.assignFrom(allResults); // does this get all?	    return true;	}	// If we fall out, no matches.	return false;    }