It states zero or more event of whitespace figures, followed by a comma after which followed by zero or more occurrence of whitespace people.Having said that x.replaceAll("s+", ""); will be a lot more productive means of trimming spaces (if string can have multiple contiguous Areas) mainly because of doubtless fewer no of replacements owing the to