}
private Collection<Language> listMatchingLanguages(@Nullable String query, int pageSize) {
- Pattern pattern = Pattern.compile(query == null ? MATCH_ALL : MATCH_ALL + Pattern.quote(query) + MATCH_ALL, Pattern.CASE_INSENSITIVE);
+ Pattern pattern = Pattern.compile(query == null ? MATCH_ALL : Pattern.quote(query), Pattern.CASE_INSENSITIVE);
SortedMap<String, Language> languagesByName = Maps.newTreeMap();
for (Language lang : languages.all()) {
- if (pattern.matcher(lang.getKey()).matches() || pattern.matcher(lang.getName()).matches()) {
+ if (pattern.matcher(lang.getKey()).find() || pattern.matcher(lang.getName()).find()) {
languagesByName.put(lang.getName(), lang);
}
}