boolean (final String text, XmlIndex index) { if (text == null) return false; if (index.strings.contains(text)) return true; Pattern pattern = index.pattern; return pattern != null && pattern.matcher(text).matches(); }