回答編集履歴
2
よく見たら, 書式指定では濁点半濁点がくっつきませんでしたので戻し
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
String s = "アガパ 012 ABC ㈱";
|
16
16
|
|
17
|
-
Pattern p = Pattern.compile("([
|
17
|
+
Pattern p = Pattern.compile("([ヲ-゚A-Za-z0-9]+)");
|
18
18
|
|
19
19
|
Matcher m = p.matcher(s);
|
20
20
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
while(m.find()) {
|
24
24
|
|
25
|
-
m.appendReplacement(sb, Normalizer.normalize(m.group(), Normalizer.Form.NFK
|
25
|
+
m.appendReplacement(sb, Normalizer.normalize(m.group(), Normalizer.Form.NFKD));
|
26
26
|
|
27
27
|
}
|
28
28
|
|
1
カナパターン部分を書式指定化
test
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
|
15
15
|
String s = "アガパ 012 ABC ㈱";
|
16
16
|
|
17
|
-
Pattern p = Pattern.compile("([
|
17
|
+
Pattern p = Pattern.compile("([\p{IsKatakana}A-Za-z0-9]+)");
|
18
18
|
|
19
19
|
Matcher m = p.matcher(s);
|
20
20
|
|