It states zero or more occurrence of whitespace people, followed by a comma and afterwards followed by zero or maybe more event of whitespace people. Having said that x.replaceAll("\s+", ""); are going to be far more effective technique for trimming spaces (if string might have a number of contiguous Areas) https://mantra-mushroom-chocolate64207.pages10.com/the-2-minute-rule-for-mantra-mushroom-chocolate-66872558