public int findPrevious(){
  if (findString.length() == 0 || startIndex < findString.length() - 1) {
    return -1;
  }
  try {
    int nextMatch=matchLowerCase.length - 1;
    Segment text=new Segment();
    text.setPartialReturn(false);
    document.getText(0,startIndex + 1,text);
    char previous=text.last();
    for (text.last(); previous != Segment.DONE; previous=text.previous()) {
      char current=text.current();
      if (current == matchUpperCase[nextMatch] || current == matchLowerCase[nextMatch]) {
        nextMatch--;
        if (nextMatch == -1) {
          int foundIndex=text.getIndex() - text.getBeginIndex();
          if (matchType == MatchType.CONTAINS) {
            return foundIndex;
          }
 else           if (matchType == MatchType.STARTS_WITH) {
            if (!isWordChar(foundIndex - 1)) {
              return foundIndex;
            }
          }
 else           if (matchType == MatchType.FULL_WORD) {
            if (!isWordChar(foundIndex - 1) && !isWordChar(foundIndex + matchLowerCase.length)) {
              return foundIndex;
            }
          }
          nextMatch=matchLowerCase.length - 1;
        }
      }
 else {
        nextMatch=matchLowerCase.length - 1;
      }
    }
    return -1;
  }
 catch (  BadLocationException e) {
    throw new IndexOutOfBoundsException();
  }
}

public int findPrevious ( ) { if ( findString . length ( ) == 0 || startIndex < findString . length ( ) - 1 ) { return - 1 ; } try { int nextMatch = matchLowerCase . length - 1 ; Segment text = new Segment ( ) ; text . setPartialReturn ( false ) ; document . getText ( 0 , startIndex + 1 , text ) ; char previous = text . last ( ) ; for ( text . last ( ) ; previous != Segment . DONE ; previous = text . previous ( ) ) { char current = text . current ( ) ; if ( current == matchUpperCase [ nextMatch ] || current == matchLowerCase [ nextMatch ] ) { nextMatch -- ; if ( nextMatch == - 1 ) { int foundIndex = text . getIndex ( ) - text . getBeginIndex ( ) ; if ( matchType == MatchType . CONTAINS ) { return foundIndex ; } else if ( matchType == MatchType . STARTS_WITH ) { if ( ! isWordChar ( foundIndex - 1 ) ) { return foundIndex ; } } else if ( matchType == MatchType . FULL_WORD ) { if ( ! isWordChar ( foundIndex - 1 ) && ! isWordChar ( foundIndex + matchLowerCase . length ) ) { return foundIndex ; } } nextMatch = matchLowerCase . length - 1 ; } } else { nextMatch = matchLowerCase . length - 1 ; } } return - 1 ; } catch ( BadLocationException e ) { throw new IndexOutOfBoundsException ( ) ; } }
attempts to find the previous subsequence of the input sequence that matches the pattern . < p > this method starts at the beginning of the input sequence or , if a previous invocation of the method was successful and the matcher has not since been reset , at the first character not matched by the previous match .
