Change to:
```
if (stripWhitespace) text = text.replaceAll(whitespaceRegEx, '');
```
and remove the _stripWhitespace() method.