I'm trying to replace all all spaces in string with one space. I'm trying this:
String src = "2. Test Sentence with spaces";
String out = src.replaceAll("\\s+", " ");
System.out.println(out);
And this is what I'm getting:
2. Test Sentence with spaces
Spaces after dot were not replaced... Why?