Java正则表达式 匹配两个字符串中间的内容_JustDoSelf的博客-CSDN博客_正则匹配中间内容
Java如何读取txt文件的内容?_擦肩而过的博客-CSDN博客_java 读取txt
@Test
public void test() {
try {
String reg = "(?<=data-link=\").*?(?=data-title=)";
Path path = Paths.get("F:\\desk\\ttttt.txt");
byte[] data = Files.readAllBytes(path);
String temp = new String(data, "utf-8");
Pattern pattern = Pattern.compile(reg);
Matcher matcher = pattern.matcher(temp);
while( matcher.find() ){
System.out.println(matcher.group());
}
} catch (IOException e) {
e.printStackTrace();
}
}