It says zero or more occurrence of whitespace characters, followed by a comma after which you can accompanied by zero or maybe more incidence of whitespace figures.However x.replaceAll("s+", ""); will likely be far more productive strategy for trimming spaces (if string may have a number of contiguous spaces) since of potentially much less no of re