// get the part of the matched text
String part = getPart(m, text);
// we skip boundary word
Pattern pattern = Pattern.compile(".\\b.");
Matcher ma = pattern.matcher(part);
if (!ma.find()) {
continue;
}
// We skip the part that already include %{Foo}
Pattern pattern2 = Pattern.compile("%\\{[^}+]\\}");
Matcher ma2 = pattern2.matcher(part);
if (ma2.find()) {
continue;
}
texte = StringUtils.replace(texte, part, "%{" + key + "}");
}
// }