使用 Jsoup 获取图像
Getting Image using Jsoup
请帮我理解这个表达式
Elements images = document.select("img[src~=(?i)\.(png|jpe?g|gif)]");
我不明白这部分:
document.select("img[src~=(?i)\.(png|jpe?g|gif)]");
我目前正在制作一个在线下载漫画图像的程序。
您所询问的表达式部分称为 Regular Expression。
引用维基百科,
A regular expression is a sequence of characters that define a search
pattern
在您的用例中,手边的正则表达式用于识别所有具有 src 属性且文件名扩展名为 .png 或 .jpg/.jpeg 或 .gif 的 img 标签。
您可以使用 this 工具对其进行测试
请帮我理解这个表达式
Elements images = document.select("img[src~=(?i)\.(png|jpe?g|gif)]");
我不明白这部分:
document.select("img[src~=(?i)\.(png|jpe?g|gif)]");
我目前正在制作一个在线下载漫画图像的程序。
您所询问的表达式部分称为 Regular Expression。
引用维基百科,
A regular expression is a sequence of characters that define a search pattern
在您的用例中,手边的正则表达式用于识别所有具有 src 属性且文件名扩展名为 .png 或 .jpg/.jpeg 或 .gif 的 img 标签。
您可以使用 this 工具对其进行测试