question: @ Override public List < MatchResult > find ( String str , int maxResults ) { str = str . trim ( ) ; List < MatchResult > results = new ArrayList < MatchResult > ( ) ; int start = 0 ; while ( start != - 1 ) { start = str . indexOf ( string , start ) ; if ( start != - 1 ) { int end = start + string . length ( ) ; if ( ! whole || StringUtils . isDelimited ( str , start , end ) ) { results . add ( new MatchResult ( start , end ) ) ; } if ( results . size ( ) >= maxResults ) { return results ; } start = end ; } } return results ; }
target:  Searches for all possible occurrences of the template in the provided string. Stops if the maximum number of results is reached.