code: public static Object find(String strPattern, String strInput, int offset, boolean caseSensitive, boolean matchAll) throws MalformedPatternException {
  	Perl5Matcher matcher = new Perl5Matcher();
  	PatternMatcherInput input = new PatternMatcherInput(strInput);
  	Array matches = new ArrayImpl();
  
  	int compileOptions = caseSensitive ? 0 : Perl5Compiler.CASE_INSENSITIVE_MASK;
  	compileOptions += Perl5Compiler.SINGLELINE_MASK;
  	if (offset < 1) offset = 1;
  
  	Pattern pattern = getPattern(strPattern, compileOptions);
  
  	if (offset <= strInput.length()) {
  	    input.setCurrentOffset(offset - 1);
  
  	    while (matcher.contains(input, pattern)) {
  		Struct matchStruct = getMatchStruct(matcher.getMatch());
  		if (!matchAll) {
  		    return matchStruct;
  		}
  
  		matches.appendEL(matchStruct);
  	    }
  
  	    if (matches.size() != 0) {
  		return matches;
  	    }
  	}
  
  	Array posArray = new ArrayImpl();
  	Array lenArray = new ArrayImpl();
  	Array matchArray = new ArrayImpl();
  	posArray.appendEL(Constants.INTEGER_0);
  	lenArray.appendEL(Constants.INTEGER_0);
  	matchArray.appendEL("");
  
  	Struct struct = new StructImpl();
  	struct.setEL("pos", posArray);
  	struct.setEL("len", lenArray);
  	struct.setEL("match", matchArray);
  
  	if (matchAll) {
  	    matches.appendEL(struct);
  	    return matches;
  	}
  
  	return struct;
      }
docs: find occurence of a pattern in a string (same like indexOf), but dont return first ocurence , it
  return struct with all information
  
  @param strPattern
  @param strInput
  @param offset
  @param caseSensitive
  @return
  @throws MalformedPatternException