安卓的java得到字符串HTML图像标记字符串、标记、图像、java

2023-09-14 23:03:45 作者:_吃不起辣条还装什么逼!

我试着从给定的字符串获得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="https://m.xsw88.com/allimgs/daicuo/20230914/5.png.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

推荐答案

请参阅this问题以供参考。基本上它说,使用:

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

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