Android regex to get links to web page source

I am looking for RegEx to match links from a web page source. If you have any code samples, it will be assigned.

thanks

+4
source share
1 answer

To match the values ​​of the href attribute, 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); } 
+4
source

Source: https://habr.com/ru/post/1413591/


All Articles