我已经看到了link。但我的问题与此完全不同。
我的seed.txt看起来像:
http://a.b.c/
http://d.e.f/
我的regex-urlfilter.txt看起来像这样:
# skip file: ftp: and mailto: urls
-^(file|ftp|mailto):
# skip image and other suffixes we can't yet parse
# for a more extensive coverage use the urlfilter-suffix plugin
-\.(gif|GIF|jpg|JPG|png|PNG|ico|ICO|css|CSS|sit|SIT|eps|EPS|wmf|WMF|zip|ZIP|ppt|PPT|mpg|MPG|xls|XLS|gz|GZ|rpm|RPM|tgz|TGZ|mov|MOV|exe|EXE|jpeg|JPEG|bmp|BMP|js|JS)$
# skip URLs containing certain characters as probable queries, etc.
-[?*!@=]
# skip URLs with slash-delimited segment that repeats 3+ times, to break loops
#-.*(/[^/]+)/[^/]+\1/[^/]+\1/
# accept anything else
+^http://a.b.c/*
我想抓取一些这样的网址:
http://a.b.c/index.php?id=1
http://a.b.c/about.php
http://a.b.c/help.html
http://a.b.c/test1/test2/
http://a.b.c/index.php?usv=contact
http://a.b.c/index.php?usv=vdetailpro&id=104&sid=74
等等
我已通过命令测试:bin/nutch org.apache.nutch.net.URLFilterChecker -allCombined
并认识到正则表达式并不匹配。
谢谢你!
答案 0 :(得分:0)
在regex-urlfilter.txt
中使用这些正则表达式解决方法1
+^http://([a-z0-9]*\.)*a.b.c/
+^http://([a-z0-9]*\.)*d.e.f/
溶液2
+^http://([a-z0-9]*\.)*(a.b.c|d.e.f)/