Need to grab the text between a particular HTML element using regex in java
843834Sep 17 2008 — edited Sep 18 2008I have following HTML
<tr>
<td>
<div class="stmtcol1">
<span class="tex1">$235.17</span>
</div>
</td>
<td>
<div class="stmtcol1">
<span class="tex2">$136.34</span>
</div>
</td>
</tr>
In my java program, I need to grab the text ONLY between <SPAN> element using some kind of regular expression based on the attribute class="tex1".
So ideally I am looking for the just "$235.17" from the above XML.
I googled enough but couldn't find anything specific.
When I used regular expression "(?<=^|>)[^><]+?(?=<|$)" I get all the text from my xml file.
Any help will be highly appreciated.
Edited by: pooleswa on Sep 17, 2008 10:09 PM