IBMSOFT
ibmsoft 努力不一定成功,放棄一定失敗! 堅持自己的理想,實現自己的目標! 有好的想法就要出想辦法實現!
BlogJava
首頁
新隨筆
聯系
聚合
管理
8 Posts :: 2 Stories :: 3 Comments :: 0 Trackbacks
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
我參與的團隊
鄭州Java小組(0/0)
隨筆檔案
2007年3月 (4)
2006年8月 (1)
2006年7月 (1)
2006年6月 (2)
文章檔案
2007年3月 (1)
2006年5月 (1)
搜索
最新評論
1.?re: 免費的html編輯工具
KP[M'KM['P;K
--NBN
2.?re: 免費的html編輯工具
fcxzcadsfa
--ffxz
3.?re: Java實現利用搜索引擎收集網址的程序
好!!!!!!!!!!!!!!!!
-- javaPlayer
閱讀排行榜
1.?免費的html編輯工具(859)
2.?Java實現利用搜索引擎收集網址的程序(776)
3.?appfuse 再學習!(410)
4.?Nutch Cache Page picture problem(346)
5.?use google or baidu get the useful url(342)
評論排行榜
1.?免費的html編輯工具(2)
2.?Java實現利用搜索引擎收集網址的程序(1)
3.?ajax(0)
4.?權限實現(0)
5.?權限實現(0)
Nutch Cache Page picture problem
I use nutch to crawl the intranet.but you know ,the cache.jsp have mang problem (X).Because I filter the gif|jgf and so on
then I use ORO replace the html content use my customer pif
Code:
?1
????String?sRegexpSrc
=
"
src\\s*=\\s*\
"
([\\.]
*
)
/
([a
-
z]
*
)
/
([
^
\
"
]+)
"
;
?2
????String?sRegxpBackground?
=
"
background\\s*=\\s*\
"
([.]
*
)
/
([a
-
z]
*
)
/
([
^
\
"
]+)
"
;
?3
????String?sAdd?
=
?
""
;
?4
????String?sNewContent
=
""
;
?5
????PatternCompiler?compiler?
=
?
new
?Perl5Compiler();
?6
????Pattern?pattern?
=
?
null
,pattern1?
=
?
null
?;
?7
????
try
{
?8
????????pattern?
=
?compiler.compile(sRegexpSrc,Perl5Compiler.CASE_INSENSITIVE_MASK);
?9
????????pattern1?
=
?compiler.compile(sRegxpBackground,Perl5Compiler.CASE_INSENSITIVE_MASK);
10
????}
catch
?(MalformedPatternException?e)
{
11
????????
12
????????e.printStackTrace();
13
????}
14
????PatternMatcher?matcher?
=
?
new
?Perl5Matcher();
15
16
if
?(matcher.contains(content,?pattern))
{
17
????????????????????MatchResult?result?
=
?matcher.getMatch();
18
????????????????????
//
System.out.println(result.toString());
19
????????????????????sAdd?
=
?result.group(
1
)
+
"
/
"
+
result.group(
2
)
+
"
/
"
+
result.group(
3
);
20
????????????????????
//
System.out.println("sAdd=?"+sAdd);
21
????????????????????sNewContent
=
content.replaceAll(sAdd,
"
\\img\\liuxuan
"
);
22
????????????????????
//
System.out.println("FinalString="+sTest.replaceAll(sAdd,"/img/liuxuan.png"));
23
????????????
//
System.out.print("sTest=?"+result.group(1)+"/"+result.group(2));
24
????????}
else
{
25
????????????
//
System.out.print("Can't?find?the?String?");
26
27
????????}
posted on 2006-06-28 21:03
ibmsoft
閱讀(346)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © ibmsoft
主站蜘蛛池模板:
宽城
|
金秀
|
大洼县
|
韩城市
|
静乐县
|
霍城县
|
武威市
|
武定县
|
乌兰浩特市
|
襄樊市
|
米泉市
|
中山市
|
斗六市
|
铁力市
|
安丘市
|
宝兴县
|
阜南县
|
郸城县
|
尼玛县
|
舟曲县
|
新竹县
|
繁峙县
|
无锡市
|
青阳县
|
岳阳县
|
林州市
|
延吉市
|
灵丘县
|
威宁
|
长武县
|
连平县
|
海城市
|
定襄县
|
若尔盖县
|
库车县
|
霍邱县
|
镇安县
|
柳江县
|
廊坊市
|
夏津县
|
易门县
|