void () { try { int flags = 0; if (!myCaseSensitive) { flags = Pattern.CASE_INSENSITIVE; if (StringUtil.findFirst(myPatternString, c -> c >= 0x80) >= 0) { flags |= Pattern.UNICODE_CASE; } } myPattern = Pattern.compile(myPatternString, flags); String optimizedPattern = myPatternString; optimizedPattern = StringUtil.trimStart(optimizedPattern, ".*"); myOptimizedIndexingPattern = Pattern.compile(optimizedPattern, flags); myStringsToFindFirst = IndexPatternOptimizer.getInstance().extractStringsToFind(myPatternString); } catch(PatternSyntaxException e){ myPattern = null; myOptimizedIndexingPattern = null; myStringsToFindFirst = Collections.emptyList(); } }