public static void main(String args[]) {
final StringBuilder builder = new StringBuilder();
String input = "Autism: 'Weak “Central Coherence” in: II. Real-life and MMag. ? ? ? ö ü ä André Gazsó";
final Pattern specialCharsForFieldContent = Pattern.compile("([-+\"!(){}\\[\\]^\\~\\: \\\\]|\\|\\||&&)");
for (char c : input.toCharArray()) {
Matcher m = specialCharsForFieldContent.matcher(input);
if (Character.isLetterOrDigit(c) || m.find()) {
builder.append(Character.isLowerCase(c) ? c : c);
}
}
System.out.println(builder.toString());
}
在中央之前有标点符号,而不是双引号。我想删除它。
请参阅以下链接:
答案 0 :(得分:0)
试试这个:
String words = input.replaceAll("[^a-zA-Z ]", "");