The 's' replaces 1 House match at a time however the 's+' replaces The complete Room sequence at the same time with the next parameter. Even so x.replaceAll("\s+", ""); will likely be much more efficient strategy for trimming spaces (if string might have a number of contiguous spaces) mainly because https://mantra-bars-euphoria-bar54207.bloguetechno.com/little-known-facts-about-mantra-mushroom-chocolate-66647319