Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java:使用JSoup提取其中包含某个单词的所有链接?_Java_Html_Parsing_Jsoup - Fatal编程技术网

Java:使用JSoup提取其中包含某个单词的所有链接?

Java:使用JSoup提取其中包含某个单词的所有链接?,java,html,parsing,jsoup,Java,Html,Parsing,Jsoup,可能是一个不清楚的问题,下面是代码和说明: Document doc = Jsoup.parse(exampleHtmlData); Elements certainLinks = doc.select("a[href=google.com/example/]"); 字符串exampleThmlData包含来自特定站点的已解析HTML源。这个网站有很多链接可以将用户直接链接到谷歌。例如: http://google.com/example/hello http://goog

可能是一个不清楚的问题,下面是代码和说明:

    Document doc = Jsoup.parse(exampleHtmlData);

    Elements certainLinks = doc.select("a[href=google.com/example/]");
字符串exampleThmlData包含来自特定站点的已解析HTML源。这个网站有很多链接可以将用户直接链接到谷歌。例如:

http://google.com/example/hello 
http://google.com/example/certaindir/anotherdir/something
http://google.com/anotherexample
我想使用doc.select函数提取链接中包含google.com/example/的所有链接。如何使用JSoup实现这一点

您可以参考


非常感谢你的好意,先生,你救了我的命:)
Document doc = Jsoup.parse(exampleHtmlData);
Elements certainLinks = doc.select("a[href*=google.com/example/]");