Hi I’m trying to use a replaceAll in java, to delete some html content of image:
This is my input
String html = ' asd<i> qwe qwe<u>qweqwe</u></i><u>wqeqwesd.<img alt="vechile" src="urldirectionstring" style="float:left; height:190px; width:400px" /></u>';
So what I’m trying to do is replace all content of <img ...>
and just return in replace this:
"Image Url: urldirectionstring";
So just replace the tag img, all the rest, let it, only touch this tag, and for now I have this, but its not enougth;
String replaceImg = html.replaceAll("<img[^>]*/>","Image Url: "+$srcImgdirection);
So, as you can see, I don’t have an idea how to get the urldirectionstring as variable in the replace.
----------- LAST EDIT -----------
I found this regex to get the urlstringdirection, but now I don’t how to replace it only and add the text:
String replaceImg = html.replaceAll("<img.*src="(.*)"[^>]*/?>","Image Url: "+$srcImgdirection);