Yes, but if you have three spaces in a row, it will replace the first two with a single space, but the two spaces that are left over will not be replaced, because the matcher has moved past the first one (which was a replacement).
Stephan van Hulst
posted 3 years ago
Here is a short program that illustrates what I mean:
I haven't been following this thread carefully; once it go onto the second page it started to get long‑winded. But a long time ago somebody showed how to extract upper case letters from the String with a Stream. So why do you insist on wanting a regex?