安卓的java得到字符串HTML图像标记 [英] android java get html image tag from string

查看:162
本文介绍了安卓的java得到字符串HTML图像标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着从给定的字符串获得HTML图像标记的URL。应该有一些经常EX pression得到它。但不知道该怎么做。任何人都可以帮助我在此。

Im trying to get HTML image tag url from the given string. There should be some regular expression to get it. But don't know how to do it. Can anyone help me on this.

例如。

I have string like this with <br> some HTML<b>tag</b>
with <img src="http://xyz.com/par.jpg" align="left"/> image tags in it.
how can get it ?

我只想要的 http://xyz.com/par.jpg 从字符串

I want only http://xyz.com/par.jpg from the string

推荐答案

请参阅<一href="http://stackoverflow.com/questions/1079423/regular-ex$p$pssion-to-get-an-attribute-from-html-tag">this问题以供参考。基本上它说,使用:

Please see this question for reference. Basically it says to use:

String imgRegex = "<img[^>]+src\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>";

这篇关于安卓的java得到字符串HTML图像标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆