period = period.replaceAll("[^0-9?!.]"," ").trim().replaceAll("\\s+", " ");
public class Test {
public static void main(String[] args) {
String value = "!dsdsds 10.12.2022 ... 10.12.2022 mnmnm 20.01.2022 !dsdsds";
Pattern p = Pattern.compile("(\\d{2}.\\d{2}.\\d{4})");
Matcher matcher = p.matcher(value);
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
sb.append(matcher.group());
sb.append(" ");
}
System.out.println(sb);
}
}