【发布时间】:2019-03-07 14:00:16
【问题描述】:
什么正则表达式可以匹配相似的字符,例如 (ä 和 a) 或俄语 (и 和 й)? 在我的代码下面...
Sting text1 = " Passagiere noch auf ihr fehlendes Gepäck"
Sting text2 = " Passagiere noch auf ihr fehlendes Gepack"
Pattern p1 = Pattern.compile("\\b" + "Gepack");
Pattern p2 = Pattern.compile("\\b" + "Gepack");
Matcher m1 = p1.matcher(text1); // doesn't find any occurrence
Matcher m2 = p2.matcher(text2) // founds one occurrence
【问题讨论】:
-
不确定这是正确的副本,因为链接到文章更多的是音译而不是规范化。
标签: java android regex pattern-matching