How to remove punctuation from a string in Java?

To remove punctuation from a string in Java, call the String.replaceAll("\\p{Punct}", "") method.

\\p{Punct} is a RegEx match group that means "punctuation characters":

"just.some,string!".replaceAll("\\p{Punct}", ""); // justsomestring