I want to remove trailing white spaces and tabs from my code without removing empty lines.
I tried:
\\s+$
and:
([^\\n]
In Java:
String str = " hello world "; // prints "hello world" System.out.println(str.replaceAll("^(\\s+)|(\\s+)$", ""));