标签:find 匹配 turn img 链接 system return cas pattern
public static List<String> getImg(String htmlStr) { List<String> list = new ArrayList<String>(); String img = ""; Pattern p_image; Matcher m_image; // String regEx_img = "<img.*src=(.*?)[^>]*?>"; //图片链接地址 String regEx_img = "<img.*src\\\\s*=\\\\s*(.*?)[^>]*?>"; p_image = Pattern.compile("^data:image/(png|gif|jpg|jpeg|bmp|tif|psd|ICO);base64,.*"); //p_image = Pattern.compile(regEx_img, Pattern.CASE_INSENSITIVE); m_image = p_image.matcher(htmlStr); while (m_image.find()) { // 得到<img />数据 img = m_image.group(); System.out.println(img.toString()); } return list; }
标签:find 匹配 turn img 链接 system return cas pattern
原文地址:https://www.cnblogs.com/pxblog/p/10805284.html