I thought that wasn\'t that hard to do, but I want to remove all empty lines (or lines just containing blanks and tabs in Java) with String.replaceAll.
My regex look
I don't know the syntax for regular expressions in Java, but /^\s*$[\n\r]{1,}/gm is the regex you're looking for.
/^\s*$[\n\r]{1,}/gm
You probably write it like this in Java:
s = s.replaceAll("(?m)^\\s*$[\n\r]{1,}", "");
I tested it with JavaScript and it works fine.