Remove trailing spaces from string regex

This code below will show how to strip trailing spaces in string using a regex.

Straight up Java

@Test
public void strip_trailing_spaces() {

    String removeSpace = "   spaces   ";

    String leftTrim = removeSpace.replaceAll("\s+$", "");

    assertEquals("   spaces", leftTrim);
}