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地址
最新推荐文章于 2023-08-07 23:01:08 发布