Hi,
I have a huge string containing html tags, some of these tags being <img src="URL"> ones. I need to extract the urls from all the occurences of these tags in the input string. This is what I am doing:
Pattern p=null;
Matcher m= null;
String word0= null;
String word1= null;
p= Pattern.compile(".*<img[^>]*src=\"([^\"]*)",Pattern.CASE_INSENSITIVE);
m= p.matcher(txt);
while (m.find())
{
word0=m.group(1);
System.out.println(word0.toString());
}
The problem with this code is that this prints only the last URL. For example if there are 5 <img src="URL"> tags, this code prints only the URL contained withn the 5th< img src> tag. Please tell me how to solve this.
Thanking you in advance