0
私はリストを作成し、特定のキーワードを持つリスト項目ごとにカウンタを増やそうとしています。私はこれをコンパイルすることができません。どうして?リストのパターンマッチングプログラムをコンパイルできません
int count = 0;
String keyword = args[1];
Pattern p = Pattern.compile(keyword);
Matcher m = p.matcher(p);
/* For each paragraph in the document... */
for (XWPFParagraph paragraph : paragraphs) {
/* Add to List */
words.add(paragraph.getText());
System.out.println(paragraph);
/* Iterate keyword count */
while (m.find()) {
count++;
}
}
エラーが何を検索しなければなりませんおそらくここですか? –
正規表現に使用しているパターンを表示できますか? –
'' Matcher m = p.matcher(p); ''の2番目のpは赤色で、CharSequenceはPattern ...には適用できません。そして、以下の答えは正しいです。 – santafebound