public static Comparator<String> createMatchComparator(final String userInput) {

        if (userInput == null) {
            return String.CASE_INSENSITIVE_ORDER;
        } else if (userInput.startsWith(REGEX_PREFIX)
                   || userInput.startsWith(STARTS_WITH_PREFIX)
                   || userInput.startsWith(ENDS_WITH_PREFIX)
                   || userInput.startsWith(EXACT_MATCH_PREFIX)
                   || userInput.startsWith(WORD_BOUNDARY_PREFIX)
                   || userInput.startsWith(NOT_OPERATOR_STR)) {
            return String.CASE_INSENSITIVE_ORDER;
        } else {
            // TODO @AT Need to consider how to rank word boundary matches
            // applicable for contains and chars anywhere
            final String strippedUserInput = stripPrefixesAndSuffixes(userInput);
            return createShortestMatchComparator(strippedUserInput);
        }
    }
Wraps the passed {@link Predicate} with one that returns result
if the value under test is null
stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/StringPredicateFactory.java