I'm trying to make the first letter of a sentence uppercase and the rest lowercase using regex in Java.
I know functions like toLowerCase and toUpperCase exist but I MUST use regex for academic reasons.
If a word except the first word starts with a capital letter or written in mixed case, the word should be converted to all lowercase letters. The first word should start with a capital letter
john WaLKs into A New world. ----> John walks into a new world.
I've tried using something like this but it doesn't work and I don't know what to do.
data.replaceAll("([A-Z])","$1\L");