It claims zero or more prevalence of whitespace characters, followed by a comma and afterwards accompanied by zero or even more incidence of whitespace people.However x.replaceAll("s+", ""); is going to be extra efficient way of trimming Areas (if string might have many contiguous spaces) mainly because of potentially fewer no of replacements owing