java - Using JSoup to parse text between two different tags -
i have following html...
<h3 class="number"> <span class="navigation"> 6:55 <a href="/results/result.html" class="under"><b>»</b></a> </span>**this text need parse!**</h3>
i can use following code extract text h3 tag.
element h3 = doc.select("h3").get(0);
unfortunately, gives me in tag.
6:55 » text need parse!
can use jsoup parse between different tags? there best practice doing (regex?)
(regex?)
no, can read in answers of this question, can't parse html using regular expression.
try this:
element h3 = doc.select("h3").get(0); string h3text = h3.text(); string spantext = h3.select("span").get(0).text(); string textbetweenspanendandh3end = h3text.replace(spantext, "");
Comments
Post a Comment