<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/13835" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-07-29T07:03:48-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/13835</id>

		<entry>
		<author><name><![CDATA[Metuant]]></name></author>
		<updated>2007-07-29T07:03:48-04:00</updated>

		<published>2007-07-29T07:03:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74824#p74824</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74824#p74824"/>
		<title type="html"><![CDATA[Help with regexp/regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74824#p74824"><![CDATA[
Thanks for the help - it works great :]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9182">Metuant</a> — Sun Jul 29, 2007 7:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2007-07-29T03:56:57-04:00</updated>

		<published>2007-07-29T03:56:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74813#p74813</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74813#p74813"/>
		<title type="html"><![CDATA[Help with regexp/regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74813#p74813"><![CDATA[
Perhaps sanitize the data before you attempt to parse it. So newlines, carriage returns, tabs, etc.. get eliminated before you get to that step.<div class="codebox"><p>Code: </p><pre><code>regsub -all "\t" $data "" dataregsub -all "\n" $data "" dataregsub -all "\r" $data "" dataregsub -all "\v" $data "" data</code></pre></div>You can use a quantifier to express a range. This snippet should work:<div class="codebox"><p>Code: </p><pre><code>      while {[regexp "&lt;!--name--&gt;&lt;td class=\'tablebottom\'&gt;(.*?)&lt;/td&gt;.*?&lt;!--price--&gt;&lt;td class=\"tablebottom\"&gt;(.*?)&lt;/td&gt;.*?&lt;td class=\"tablebottom\" width=\"20\"&gt;" $data junk tname tprice]} {         regsub "&lt;!--name--&gt;&lt;td class=\'tablebottom\'&gt;[addslashes $tname]&lt;/td&gt;.*?&lt;!--price--&gt;&lt;td class=\"tablebottom\"&gt;[addslashes $tprice]&lt;/td&gt;.*?&lt;td class=\"tablebottom\" width=\"20\"&gt;" $data - data         if {$i == 0 || ([string match [string tolower [string range $item 0 1]] [string tolower [string range $tname 0 1]]] &amp;&amp; [string length $tname] &lt; [string length $name])} {            set name $tname            set price $tprice</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Jul 29, 2007 3:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Metuant]]></name></author>
		<updated>2007-07-28T18:38:27-04:00</updated>

		<published>2007-07-28T18:38:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=74804#p74804</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=74804#p74804"/>
		<title type="html"><![CDATA[Help with regexp/regsub]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=74804#p74804"><![CDATA[
Hi,<br><br>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.<br><br>The block of information I'm trying to parse (which is sometimes repeated multiple times - hence the while in the code) is:<br><br>&lt;tr&gt;<br>&lt;td class='tablebottom'&gt;&lt;img src="/img/member.gif" alt="[M]"/&gt;&lt;/td&gt;<br>&lt;!--name--&gt;&lt;td class='tablebottom'&gt;Abyssal whip&lt;/td&gt;<br>&lt;td class="tablebottom" title="Former average price: 1,650,000gp [decreased by 50,000gp]"&gt;&lt;img src="/img/market/p_d.gif" alt="This price has decreased" /&gt;&lt;/td&gt;<br>&lt;!--price--&gt;&lt;td class="tablebottom"&gt;1,550,000gp - 1,650,000gp&lt;/td&gt;<br>&lt;td class="tablebottom" width="20"&gt;&lt;a href="/priceguide.php?report=45&amp;par=" title="Report Incorrect Price"&gt;&lt;img src="/img/!.gif" alt="[!]" border="0" /&gt;&lt;/a&gt;&lt;/td&gt;<br>&lt;td class="tablebottom"&gt;&lt;a href="/priceguide.php?category=45"&gt;Obsidian &amp; Abyssal&lt;/a&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br><br>&lt;/table&gt;&lt;/form&gt;&lt;br /&gt;<br><br>I'm trying to grab the item name (Abyssal whip) and its price (1,550,000gp - 1,650,000gp)<br>Using...<br><div class="codebox"><p>Code: </p><pre><code>                while {[regexp "&lt;!--name--&gt;&lt;td class=\'tablebottom\'&gt;(.*?)&lt;/td&gt;\n\n&lt;!--price--&gt;&lt;td class=\"tablebottom\"&gt;(.*?)&lt;/td&gt;\n&lt;td class=\"tablebottom\" width=\"20\"&gt;" $data junk tname tprice]} {regsub "&lt;!--name--&gt;&lt;td class=\'tablebottom\'&gt;[addslashes $tname]&lt;/td&gt;\n\n&lt;!--price--&gt;&lt;td class=\"tablebottom\"&gt;[addslashes $tprice]&lt;/td&gt;\n&lt;td class=\"tablebottom\" width=\"20\"&gt;" $data - dataif {$i == 0 || ([string match [string tolower [string range $item 0 1]] [string tolower [string range $tname 0 1]]] &amp;&amp; [string length $tname] &lt; [string length $name])} {set name $tnameset price $tprice</code></pre></div>I'm assuming that you can't just use \n\n to skip the line of useless data as I'd hoped..<br><br>Any help is appreciated<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9182">Metuant</a> — Sat Jul 28, 2007 6:38 pm</p><hr />
]]></content>
	</entry>
	</feed>
