e
Size: a a a
KX
KX
Dm
Dm
Dm
CD
CD
Dm
Dm
Dm
Dm
Dm
ДЯ
List<String> wordsToReplace = List.of("hello", "jvm");
String s = "hello pro.jvm";
String res = s.replaceAll(String.join("|", wordsToReplace), "*");
Получится: "* pro.*" а надо "***** pro.***"ДЯ
String replacer = String.join("", Collections.nCopies(50, "*"));
List<String> wordsToReplace = List.of("hello", "jvm");
String s = "hello pro.jvm";
Pattern pattern = Pattern.compile(String.join("|", wordsToReplace));
Matcher matches = pattern.matcher(s);
String res = matches.replaceAll(v -> replacer.substring(0, v.end() - v.start()) );
Собственно в этом и был вопрос, спасибо всем причастным )