lamp 2013-06-12
//IMG处理
publicstaticfinalStringIMG_FORMAT="<(img|IMG)[^>》]*?(src|SRC)=[\"\']([^>》]*?)[\"\'][^》]*?>";
bodyPattern=Pattern.compile(patternFormat.IMG_FORMAT);
bodyMatcher=bodyPattern.matcher(infoText);
while(bodyMatcher.find()){
intstartIndex=bodyMatcher.start();
intendIndex=bodyMatcher.end();
Stringurl=bodyMatcher.group(3);
if(url.startsWith("http:")){
url=url.replaceAll("&(amp;)*","&");
infoText=infoText.replace(startIndex,endIndex,"<imgsrc=\""+url+"\"/》");
bodyMatcher=bodyPattern.matcher(infoText);
continue;
}
if(!urlFormat.checkProtocol(url)){
URLbaseURL=newURL(rootURL);
url=newURL(baseURL,url).toString();
url=url.replaceAll("&(amp;)*","&");
infoText=infoText.replace(startIndex,endIndex,"<imgsrc=\""+url+"\"/》");
bodyMatcher=bodyPattern.matcher(infoText);
}else{
infoText=infoText.delete(startIndex,endIndex);
bodyMatcher=bodyPattern.matcher(infoText);
}
}
<object type="application/x-shockwave-flash" style="outline:none;" data="http://cdn.abowman.com/widg