regular expression match one or more spaces at end of string code example Example: java remove double spaces StringUtils.normalizeSpace(string);