ファイルから各行を読み取り、特定のサーバーからの URL を示す行のみを編集したい...私のコードは次のようになります...
Scanner ReadIsbn = new Scanner (new FileReader ("C:/Users/...."));
Pattern pat = Pattern.compile("http:////www.librarything.com//isbn//");
while ( ReadIsbn.hasNextLine()){
String line = ReadIsbn.nextLine();
Matcher m = pat.matcher(line);
if (m.matches() == true) {
EDIT line....
}
}
}
そして、それは機能していません...実際、m.matches()は常にfalseです..入力として与えるファイルには、次のような行があります:
1) http://www.librarything.com/isbn/0-9616696-7-5.html
2) http://www.librarything.com/isbn/0-86078-322-7.html
Cultural tourism : how the arts can help market tourism products, how
blablabla
(例の最初の 2 行だけを編集したい)