I have string `queryInputNameString` that is equal to `fir, spotted owl` and I'm trying to use `replaceAll()` to remove the white spaces and `split()` to separate the elements in the `inputNameArray` array when a comma occurs.

```
String noSpaces = queryInputNameString.replaceAll("\\s+","");
String[] inputNameArray = noSpaces.split("\\,");

```

So far the above returns:

```
fir
spottedowl

```

but I would like it to only remove the white spaces that occurs immediately before or after a comma and return this:

```
fir
spotted owl

```

How can I make my code ignore white spaces that are not preceded/followed by a comma?

Thanks.