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>&raquo;</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 &raquo; 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

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -