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