从http响应中删除所有图像';java中的s实体
我有一个http主体,我想在其中删除所有图像标记。例如,来自具有实体的响应:从http响应中删除所有图像';java中的s实体,java,string,http,tags,entity,Java,String,Http,Tags,Entity,我有一个http主体,我想在其中删除所有图像标记。例如,来自具有实体的响应: StringEntity entity = new StringEntity( "<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "<meta charset=\"UTF-8\">\n" +
StringEntity entity = new StringEntity(
"<!DOCTYPE html>\n" +
"<html>\n" +
"<head>\n" +
"<meta charset=\"UTF-8\">\n" +
"<title>Title of the document</title>\n" +
"</head>\n" +
"<body>\n"
+ "Content of the document..\n" +
"<img src=\"image\">\n" +
"</body>\n" +
"</html>");
StringEntity实体=新的StringEntity(
“\n”+
“\n”+
“\n”+
“\n”+
“文档的标题\n”+
“\n”+
“\n”
+“文档的内容..\n”+
“\n”+
“\n”+
"");
我尝试了以下方法,但没有改变:
String responseString = EntityUtils.toString(response.getEntity(), "UTF-8");
responseString.replaceAll("<img .*?>","");
String responseString=EntityUtils.toString(response.getEntity(),“UTF-8”);
responseString.replaceAll(“,”);
是否尝试删除问号?如果我没弄错的话,问号表示行的结尾。请尝试删除问号?如果我没弄错的话,问号表示这一行的结束。