Pattern[] (String[] prefixes) { final Pattern[] patterns = new Pattern[prefixes.length]; for (int i = 0; i < prefixes.length; i++) { final String s = shieldRegExpMetaChars(prefixes[i]); patterns[i] = Pattern.compile("\\b(" + s + "\\w+)\\b"); } return patterns; }