The regular expression: ([.,!?:;'\"-]|\\s)+ should do the trick. It is read as "for one or more occurrences of either a whitespace or punctuation". The important part here is to make sure that the '+' is kept outside the alternation, since we can have a mix of white-spaces and punctuations.
The problem with your regular expression was that you didn't take into consideration punctuations and whitespaces, but rather punctuation followed by whitespaces. If you have a 'this or that' situation, use alternation. Writing patterns one after another just increases the matching requirement; your pattern read "match any punctuation *followed* by zero or more whitespace characters" which isn't what you wanted. Hence all it did was match punctuations but blew up when faced with white-spaces.
It's possible to include exceptions by using negative lookbehind assertion feature of regular expressions. Just throw in another alternation which uses lookaround and you should be golden. But this approach would leave behind a nasty regular expression in your code so if possible, try to deal with exceptions after performing the basic splitting rather than modifying the regex.
Also, please create a new thread for your question, and refer this thread if you feel it is related rather than bumping an existing solved thread.
**how to solve invalid keystore error in android studio here is error report----------------------->
here is error report--------> error:Error:java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key palash from store "D:\MyApplication3.idea\workspace.xml": Invalid keystore format ...