We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 29e05ca commit 3121eb7Copy full SHA for 3121eb7
Chapter12/src/com/packt/java/chapter12/Exercise3.java
@@ -12,22 +12,16 @@
12
public class Exercise3 {
13
14
public static void main(String[] args) {
15
-
16
String filePath = System.getProperty("user.dir") + File.separator + "res" + File.separator + "packt.txt";
17
try {
18
String packtDump = new String(Files.readAllBytes(Paths.get(filePath)));
19
20
String regex = "(?:<a href=\")([^\"]+)(?:\"{1})";
21
22
Pattern pattern = Pattern.compile(regex);
23
Matcher matcher = pattern.matcher(packtDump);
24
25
List<String> links = new ArrayList<>();
26
27
while (matcher.find()) {
28
links.add(matcher.group(1));
29
}
30
31
System.out.println(links);
32
} catch (IOException e) {
33
e.printStackTrace();
0 commit comments