我想從一個文件中的每一行讀取和編輯只能從特定服務器提供的URL行...我的代碼是這樣......java模式
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()始終是假的.. 在我給作爲輸入文件,有喜歡的臺詞:
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
(我想編輯只的前兩行例如)