private List<StringMatchLocation> contains(final String string, final int limit) {
        if (string == null) {
            return Collections.emptyList();
        }
        final String alteredString = normaliseCaseIfRequired(string);
        int index = alteredString.indexOf(pattern);
        final List<StringMatchLocation> matches = new ArrayList<>();
        for (int i = 0; i < limit && index != -1; i++) {
            matches.add(new StringMatchLocation(index, pattern.length()));
            index = alteredString.indexOf(pattern, index + pattern.length());
        }
        return matches;
    }
Types that will need the case of pattern to be normalised if caseSensitive is true.
stroom-index/stroom-index-lucene980/src/main/java/stroom/contentindex/StringMatcher.java