我想找出正确的方法来删除所有的标点符号和空白的字符串,但保留撇号完整,例如:
won't would remain won't but desire。"会变成"desire"
我试过使用replaceAll("[\W]", ""), replaceAll("/\p{P}(?<!')/", ""), and replaceAll("[^a-zA-Z]", "")
,但它们都保留标点完整
String s = "don't.";
s = s.replaceAll("(')|(\W)", "$1");