i have this img tag from server. can anyone tell code to extract image link from the below tag.
>
onClick=showPresc
More fool proof using regex:
String html = "
whatever"
String imgRegex = "<[iI][mM][gG][^>]+[sS][rR][cC]\\s*=\\s*['\"]([^'\"]+)['\"][^>]*>";
Pattern p = Pattern.compile(imgRegex);
Matcher m = p.matcher(html);
if (m.find()) {
String imgSrc = m.group(1);
}
This will take care of possible upper/lower case issues, which the previous solution has, and also tries to handle more unusual cases.