I have a string with HTML content and I need to grab all links to .css and .js files. Now, I am using this pattern "(http:.*?.\\.css)" to grab all CSS links, but how I can include .js links, too?
Here is my full code:
List<String> urlList = new ArrayList<String>();
String str = new String(Files.readAllBytes(FileSystems.getDefault().getPath("c:" + File.separator + "nutchfiles" + File.separator + "test.html")));
Pattern p = Pattern.compile("(http:.*?.\\.css)");
Matcher m = p.matcher(str);
while (m.find()) {
LOG.info("matched urls" + m.group());
}