The 's' replaces 1 Area match at a time however the 's+' replaces the whole Place sequence simultaneously with the 2nd parameter.Nonetheless x.replaceAll("s+", ""); are going to be much more productive means of trimming Areas (if string can have several contiguous spaces) mainly because of probably less no of replacements due the to undeniable fact