The 's' replaces 1 House match at a time however the 's+' replaces The complete Room sequence at the same time with the 2nd parameter. On the other hand x.replaceAll("\s+", ""); might be far more effective technique for trimming spaces (if string might have a number of contiguous Areas) mainly https://cruzfwmcq.bluxeblog.com/63514947/s-an-overview