I'm trying to parse some information from a website using regsub and regexp, but i'm completely useless at regexp so now that they've updated their website the regexp no longer works.
The block of information I'm trying to parse (which is sometimes repeated multiple times - hence the while in the code) is:
<tr>
<td class='tablebottom'><img src="/img/member.gif" alt="[M]"/></td>
<!--name--><td class='tablebottom'>Abyssal whip</td>
<td class="tablebottom" title="Former average price: 1,650,000gp [decreased by 50,000gp]"><img src="/img/market/p_d.gif" alt="This price has decreased" /></td>
<!--price--><td class="tablebottom">1,550,000gp - 1,650,000gp</td>
<td class="tablebottom" width="20"><a href="/priceguide.php?report=45&par=" title="Report Incorrect Price"><img src="/img/!.gif" alt="[!]" border="0" /></a></td>
<td class="tablebottom"><a href="/priceguide.php?category=45">Obsidian & Abyssal</a></td>
</tr>
</table></form><br />
I'm trying to grab the item name (Abyssal whip) and its price (1,550,000gp - 1,650,000gp)
Using...
Code: Select all
while {[regexp "<!--name--><td class=\'tablebottom\'>(.*?)</td>\n\n<!--price--><td class=\"tablebottom\">(.*?)</td>\n<td class=\"tablebottom\" width=\"20\">" $data junk tname tprice]} {
regsub "<!--name--><td class=\'tablebottom\'>[addslashes $tname]</td>\n\n<!--price--><td class=\"tablebottom\">[addslashes $tprice]</td>\n<td class=\"tablebottom\" width=\"20\">" $data - data
if {$i == 0 || ([string match [string tolower [string range $item 0 1]] [string tolower [string range $tname 0 1]]] && [string length $tname] < [string length $name])} {
set name $tname
set price $tprice
Any help is appreciated