java how to replace all punctuation in a string with a space code example Example: replace all punctuation in string java inputString.replaceAll("\\p{Punct}", "");