Reputation: 45
I am looking for a RegEx to match links from a webpage source. If you have any code samples it would be appriciated.
Thanks
Upvotes: 4
Views: 1270
Reputation: 19220
To match href
attribute values you can use the following method:
final Pattern pattern = Pattern.compile("href=\"(.*+)\"");
Matcher matcher = pattern.matcher(html);
String link = null;
while (matcher.find())
{
link = matcher.group(1);
Log.i("my.regex", "Found link: " + link);
}
Upvotes: 4