public static  List<String> getImageSrc(String htmlCode) {  
        List<String> imageSrcList = new ArrayList<String>();  
        String regular="<img(.*?)src=\"(.*?)\"";  
        String img_pre="(?i)<img(.*?)src=\"";
        String img_sub="\"";
        Pattern p=Pattern.compile(regular,Pattern.CASE_INSENSITIVE);
        if(StringUtils.isNotBlank(htmlCode)){
            Matcher m = p.matcher(htmlCode);  
            String src = null;  
            while (m.find()) {  
                src=m.group();
                src=src.replaceAll(img_pre, "").replaceAll(img_sub, "").trim();
                imageSrcList.add(src);  
            }      
        }
        return imageSrcList;  
    }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
猜你喜欢
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
相关资源
相似解决方案