Skip to content

Commit 3121eb7

Browse files
authored
Update Exercise3.java
1 parent 29e05ca commit 3121eb7

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

Chapter12/src/com/packt/java/chapter12/Exercise3.java

-6
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,16 @@
1212
public class Exercise3 {
1313

1414
public static void main(String[] args) {
15-
1615
String filePath = System.getProperty("user.dir") + File.separator + "res" + File.separator + "packt.txt";
1716
try {
1817
String packtDump = new String(Files.readAllBytes(Paths.get(filePath)));
19-
2018
String regex = "(?:<a href=\")([^\"]+)(?:\"{1})";
21-
2219
Pattern pattern = Pattern.compile(regex);
2320
Matcher matcher = pattern.matcher(packtDump);
24-
2521
List<String> links = new ArrayList<>();
26-
2722
while (matcher.find()) {
2823
links.add(matcher.group(1));
2924
}
30-
3125
System.out.println(links);
3226
} catch (IOException e) {
3327
e.printStackTrace();

0 commit comments

Comments
 (0)