The 's' replaces a single Area match at any given time even so the 's+' replaces the whole House sequence simultaneously with the 2nd parameter. On the other hand x.replaceAll("\s+", ""); might be a lot more effective technique for trimming spaces (if string might have several contiguous Areas) due to https://mantramushroomchocolate97530.blogtov.com/11810216/mantra-mushroom-gummies-no-further-a-mystery