String htmlStr = "<img src='http://1231//1231/123/123.jpg' alt='图片'>";
Matcher m = Pattern.compile("src=\"?(.*?)(\"|>|\\s+)").matcher(htmlStr);
String filePath = "";
while(m.find())
{
filePath = m.group(1);
}
System.out.println(filePath);
java用正则拿到img标签的src地址
最新推荐文章于 2022-06-24 00:21:30 发布