java图片去掉文字,Java 移除html,图片 链接转文字

", "\r\n");

//

替换为换行

content = content.replaceAll("

", "\r\n");

String regex = " list = new ArrayList();

int pos = 0;

while(matcher.find(pos)){

String[] strs = new String[matcher.groupCount()+1];

for(int i=0; i<=matcher.groupCount(); i++) {

strs[i] = matcher.group(i);

}

pos = content.indexOf(matcher.group(0), pos)+strs[0].length();

if(strs[1].equals("]+)[\\s\"']?";

txt = " (图片:";

} else if(s.startsWith("]+)[\\s\"']?";

txt = " (链接:";

if(list.size()>i+1 && list.get(i+1)[0].toLowerCase().startsWith("pos0) {

txt = " (链接“"+content.substring(pos0, pos1)+"”:";

pos1 += list.get(i+1)[0].length();

content = content.replace(content.substring(pos0, pos1), "");

}

}

}

}

if(txt.length()>1) {

pattern = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);

matcher = pattern.matcher(strs[0]);

if(matcher.find()) {

String[] strs1 = new String[matcher.groupCount()+1];

for(int ii=0; ii<=matcher.groupCount(); ii++) {

strs1[ii] = matcher.group(ii);

}

if(strs1[1].length()>1) {

txt += strs1[1]+" ) ";

}else txt = "";

} else txt = "";

}

content = content.replace(strs[0], txt);

}

return content;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值