user3435341
user3435341

Reputation: 51

How can I get certain data using Jsoup?

I am websrapping a webpage using Jsoup, but It gives me some info I don't need, Is there a way to use some kind of regex in an element in java?

I get this

< span id="lblRefSellMsg">¢559.41< /span > (avoid the spaces blank spaces between <>)

And the info I need is

559.41

Finally my code looks like this

public class dato {

public static void main(String [] args) throws IOException{
    String tasa = null;
    Document d = Jsoup.connect("http://indi-eco.appspot.com/tcd").timeout(6000).get();
    Elements ele= d.select("span#lblRefSellMsg");
    System.out.print(ele);

Upvotes: 0

Views: 45

Answers (1)

Matthew Diana
Matthew Diana

Reputation: 1106

Call the text() method on your Element or Elements object:

System.out.print(ele.text());

Upvotes: 2

Related Questions