0

I have String value that is txt (not html) that contains urls:

Blabla http://www.example.com/foo1/ blabla http://www.example.com/foo2/ blabla...

I need to grab all these urls from the string using Jsoup.

Is it possible?

user2148736
  • 1,283
  • 4
  • 24
  • 39

1 Answers1

0

No, Jsoup won't do this for you. Jsoup parses HTML tags, not arbitrary strings.

If you had an HTML document containing a bunch of link tags (<a href="http://example.com/page.html>link text</a>), you could use Jsoup to parse the tags and extract the href attribute.

If you just have a string with some links, you probably want to use regular expressions, as suggested in a comment by PeterMmm.

Jeffrey Bosboom
  • 13,313
  • 16
  • 79
  • 92