The 's' replaces just one House match at any given time but the 's+' replaces the whole space sequence at once with the 2nd parameter.Having said that x.replaceAll("s+", ""); will be a lot more productive means of trimming spaces (if string can have numerous contiguous Areas) because of potentially fewer no of replacements owing the to fact that re