IBMSOFT

          ibmsoft 努力不一定成功,放棄一定失敗! 堅持自己的理想,實現自己的目標! 有好的想法就要出想辦法實現!

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            8 Posts :: 2 Stories :: 3 Comments :: 0 Trackbacks

          常用鏈接

          留言簿(2)

          我參與的團隊

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          • 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
            16if?(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)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 宽城| 金秀| 大洼县| 韩城市| 静乐县| 霍城县| 武威市| 武定县| 乌兰浩特市| 襄樊市| 米泉市| 中山市| 斗六市| 铁力市| 安丘市| 宝兴县| 阜南县| 郸城县| 尼玛县| 舟曲县| 新竹县| 繁峙县| 无锡市| 青阳县| 岳阳县| 林州市| 延吉市| 灵丘县| 威宁| 长武县| 连平县| 海城市| 定襄县| 若尔盖县| 库车县| 霍邱县| 镇安县| 柳江县| 廊坊市| 夏津县| 易门县|