The 's' replaces 1 Area match at a time but the 's+' replaces the whole space sequence at once with the 2nd parameter.Having said that x.replaceAll("s+", ""); will probably be a lot more productive means of trimming Areas (if string may have many contiguous spaces) due to the fact of probably considerably less no of replacements owing the to incont