The 's' replaces one particular Area match at a time however the 's+' replaces The complete Room sequence at the same time with the 2nd parameter. Having said that x.replaceAll("\s+", ""); might be far more effective way of trimming spaces (if string may have multiple contiguous Areas) due to the https://mantramushroomchocolateba42845.mybuzzblog.com/10959515/the-basic-principles-of-s